CiscoDevNet / terraform-provider-mso

Terraform Cisco MSO provider
https://registry.terraform.io/providers/CiscoDevNet/mso/latest/docs
Mozilla Public License 2.0
10 stars 32 forks source link

Auto-deploy #250

Closed jjman4 closed 1 year ago

jjman4 commented 1 year ago

Hi all,

I'm in a process to implement terraform/mso in our day-to-day activities. I'm quite surprised that after applying terraform, connecting to NDO portal is mandatory in order to apply the newly terraform changes to all sites, by clicking "Deploy to sites". Is there any way to automatize this 'deploy' either via terraform or the NDO api call.

Thank you in advanced.

Br, J.

akinross commented 1 year ago

Hi @jjman4,

Have you tried the resource meo_schema_template_deploy_ndo?

Also let me highlight the option to undeploy_on_destroy in mso_schema_site

jjman4 commented 1 year ago

Hi Akinross. Thanks a ton for your quick feedback and help. Yes, this matchs exactly with my need.

akinross commented 1 year ago

HI @jjman4, great then I will proceed closing the issue.

jjman4 commented 1 year ago

Hi Akinross, I've applied the above ressource but got an exception. With the deployer, got the bellow exception: Bad Request: Patch Failed, Received: Unable to find EPG 'EpgRef.....' exception while trying to update schema"{} │ │ with mso_schema_template_deploy_ndo.template_deployer, │ on main.tf line 146, in resource "mso_schema_template_deploy_ndo" "template_deployer": │ 146: resource "mso_schema_template_deploy_ndo" "template_deployer" {

Without the deployer ressource, my config is working well and able to find all the created object on NDO.

Can you please help to investigate on this? Again, thank you in advanced for your help.

br, J.

akinross commented 1 year ago

Hi @jjman4, without having logs and or more information on your configuration it will be very hard to provide any guidance.

It could be related to dependencies between resources. You might want to try a [depends_on](https://developer.hashicorp.com/terraform/language/meta-arguments/depends_on meta argument on the mso_schema_template_deploy_ndo, to assure it get's triggered at the intended moment. But this is just a guess.

What version of NDO are you running?

jjman4 commented 1 year ago

Hi Akinross, We are with NDO 3.7

Let me activate the debug log and try to analyse. Thanks for the tips. Keep you posted.

Br, J.

jjman4 commented 1 year ago

Hi @akinross

After resolving the L3OUT config issue, i've tried to apply the config with the deploy ressource.

But i'm still facing the below error.

Error: "Bad Request: Patch Failed, Received: Unable to find AP 'AnpRef(5fbb93e4110000a013d41da8,Template1,TERRAFORM-4-TESTING)' exception while trying to update schema"{} │ │ with mso_schema_template_deploy_ndo.template_deployer, │ on main.tf line 178, in resource "mso_schema_template_deploy_ndo" "template_deployer": │ 178: resource "mso_schema_template_deploy_ndo" "template_deployer" {

I suppose i have to declare AP ressource per site with mso_schema_site_anp

2023-11-09T13:22:14.204+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP request after injection GET mso/api/v1/platform/version 2023-11-09T13:22:14.204+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] Begining DO method https://xx.xx.xx.xx/mso/api/v1/platform/version 2023-11-09T13:22:14.204+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [TRACE] HTTP Request Method and URL: GET https://xx.xx.xx.xx/mso/api/v1/platform/version 2023-11-09T13:22:14.204+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [TRACE] HTTP Request Body: 2023-11-09T13:22:14.380+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP Request: GET https://xx.xx.xx.xx/mso/api/v1/platform/version 2023-11-09T13:22:14.380+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP Response: 200 200 OK &{200 OK 200 HTTP/1.1 1 1 map[Cache-Control:[no-cache] Content-Length:[136] Content-Type:[application/jso n] Date:[Thu, 09 Nov 2023 10:26:13 GMT] Expires:[Thu, 01 Jan 1970 00:00:01 GMT] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains] X-Content-Type-Options:[nosniff] X-Frame-Options:[SAMEORIGIN] X-Ratelimit-Limi t:[-1] X-Ratelimit-Remaining:[-1] X-Ratelimit-Reset:[1559582945] X-Xss-Protection:[1; mode=block]] 0xc0003a6280 136 [] false false map[] 0xc00024c500 0xc000545760} 2023-11-09T13:22:14.380+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP response unique string GET https://xx.xx.xx.xx/mso/api/v1/platform/version {"schemaversion":"","id":"63cfdf221b0000a600a75b9 6","version":"3.7.2e","platformVersion":"2.2.2d","timestamp":"2023-01-24T13:37:38.307"} 2023-11-09T13:22:14.380+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] Exit from do method 2023-11-09T13:22:14.381+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] Patch Request Container: [{"op":"add","path":"/templates/Template1/bds/-","value":{"arpFlood":true,"description":"","dhcpLabels":nu ll,"displayName":"S24-10_246_194","intersiteBumTrafficAllow":true,"l2Stretch":true,"l2UnknownUnicast":"proxy","l3MCast":false,"multiDstPktAct":"bd-flood","name":"S24-10_246_194","optimizeWanBandwidth":false,"subnets":[],"unicastRouting": true,"unkMcastAct":"flood","v6unkMcastAct":"flood","vrfRef":{"schemaId":"5d9861440e00003a00d02af2","templateName":"BOTHSITES","vrfName":"MAIN"}}}] 2023-11-09T13:22:14.381+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP request PATCH mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:22:14.381+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] Begin Injection 2023-11-09T13:22:14.381+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP request after injection PATCH mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:22:14.509+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP Request: GET https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8/validate 2023-11-09T13:22:14.509+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP Response: 400 400 Bad Request &{400 Bad Request 400 HTTP/1.1 1 1 map[Content-Language:[en] Content-Length:[185] Content-Type:[ application/json] Date:[Thu, 09 Nov 2023 10:26:13 GMT] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains] X-Content-Type-Options:[nosniff] X-Frame-Options:[SAMEORIGIN] X-Ratelimit-Limit:[-1] X-Ratelimit-Remain ing:[-1] X-Ratelimit-Reset:[1559582945] X-Xss-Protection:[1; mode=block]] 0xc0003a6500 185 [] false false map[] 0xc0002b0500 0xc00079e0b0} 2023-11-09T13:22:14.509+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] HTTP response unique string GET https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8/validate {"code":400,"message":"B ad Request: Patch Failed, Received: Unable to find AP 'AnpRef(5fbb93e4110000a013d41da8,Template1,TERRAFORM-4-TESTING)' exception while trying to update schema"} 2023-11-09T13:22:14.509+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:14 [DEBUG] Exit from do method 2023-11-09T13:22:14.512+0300 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot 2023-11-09T13:22:14.512+0300 [ERROR] vertex "mso_schema_template_deploy_ndo.template_deployer" error: "Bad Request: Patch Failed, Received: Unable to find AP 'AnpRef(5fbb93e4110000a013d41da8,Template1,TERRAFORM-4-TESTING)' exception whi le trying to update schema"{} 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] HTTP Request: PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] HTTP Response: 204 204 No Content &{204 No Content 204 HTTP/1.1 1 1 map[Cache-Control:[no-cache] Content-Language:[en] Date:[Thu, 0 9 Nov 2023 10:26:15 GMT] Expires:[Thu, 01 Jan 1970 00:00:01 GMT] Modified:[true] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains] X-Frame-Options:[SAMEORIGIN] X-Ratelimit-Limit:[-1] X-Ratelimit-Remaining:[-1 ] X-Ratelimit-Reset:[1559582945]] {} 0 [] false false map[] 0xc00078a200 0xc0008020b0} 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] HTTP response unique string PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] TERRAFORM-4-TESTING: Creation finished successfully 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] : Beginning Read 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] HTTP request GET mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] Begin Injection 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] HTTP request after injection GET mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [DEBUG] Begining DO method https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [TRACE] HTTP Request Method and URL: GET https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:22:16.479+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:22:16 [TRACE] HTTP Request Body:

br, J.

akinross commented 1 year ago

Correct all you objects should exist also on site level when deploying the configuration.

jjman4 commented 1 year ago

i've added the mso_schema_site_bd and mso_schema_site_anp.... but again the "Resource Not Found: BdDelta with name S24-10_246_194 not found in List()" error appears.

mso_schema_template_anp.ap_terraform: Creating... mso_schema_template_bd.bd_terraform: Creating... mso_schema_template_anp.ap_terraform: Creation co.mplete after 1s [id=TERRAFORM-4-TESTING] mso_schema_site_anp.ap_x1: Creating... mso_schema_site_anp.ap_x2: Creating... mso_schema_template_bd.bd_terraform: Creation complete after 2s [id=S24-10_246_194] mso_schema_site_bd_l3out.site_bd_L3out_x2: Creating... mso_schema_template_bd_subnet.bd_sub_terraform: Creating... mso_schema_site_bd_l3out.site_bd_L3out_x1: Creating... mso_schema_site_bd.bd_x2: Creating... mso_schema_site_bd.bd_x1: Creating... mso_schema_template_anp_epg.epg_terraform: Creating... mso_schema_site_anp.ap_x1: Creation complete after 2s [id=TERRAFORM-4-TESTING] mso_schema_site_anp.ap_x2: Creation complete after 2s [id=TERRAFORM-4-TESTING] mso_schema_template_bd_subnet.bd_sub_terraform: Creation complete after 2s [id=10.246.194.0] mso_schema_site_bd.bd_x1: Creation complete after 3s [id=S24-10_246_194] mso_schema_site_bd.bd_x2: Creation complete after 4s [id=S24-10_246_194] mso_schema_template_anp_epg.epg_terraform: Creation complete after 4s [id=TERRAFORM-PREPROD-APP] mso_schema_site_anp_epg.epg_x1: Creating... mso_schema_site_anp_epg.epg_x2: Creating... mso_schema_site_anp_epg_domain.site_epg_terraform_domain_x2: Creating... mso_schema_site_anp_epg_domain.site_epg_terraform_domain_x1: Creating... mso_schema_site_anp_epg.epg_x1: Creation complete after 1s [id=TERRAFORM-PREPROD-APP] mso_schema_site_anp_epg.epg_x2: Creation complete after 2s [id=TERRAFORM-PREPROD-APP] mso_schema_site_anp_epg_domain.site_epg_terraform_domain_x2: Creation complete after 3s [id=5fbb93e4110000a013d41da8/sites/5d9850730e00003100c40416-Template1/anps/TERRAFORM-4-TESTING/epgs/TERRAFORM-PREPROD-APP/domainAssociations/uni/vmmp-VMware/dom-VMM-VDS-X2-02] mso_schema_site_anp_epg_domain.site_epg_terraform_domain_x1: Creation complete after 4s [id=5fbb93e4110000a013d41da8/sites/5d98502210000038006bd141-Template1/anps/TERRAFORM-4-TESTING/epgs/TERRAFORM-PREPROD-APP/domainAssociations/uni/vmmp-VMware/dom-VMM-VDS-X1-02] ╷ │ Error: "Resource Not Found: BdDelta with name S24-10_246_194 not found in List()"{} │ │ with mso_schema_site_bd_l3out.site_bd_L3out_x1, │ on main.tf line 193, in resource "mso_schema_site_bd_l3out" "site_bd_L3out_x1": │ 193: resource "mso_schema_site_bd_l3out" "site_bd_L3out_x1" { │ ╵ ╷ │ Error: "Resource Not Found: BdDelta with name S24-10_246_194 not found in List()"{} │ │ with mso_schema_site_bd_l3out.site_bd_L3out_x2, │ on main.tf line 201, in resource "mso_schema_site_bd_l3out" "site_bd_L3out_x2": │ 201: resource "mso_schema_site_bd_l3out" "site_bd_L3out_x2" { │ ╵

2023-11-09T13:51:47.322+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:47 [DEBUG] Exit from do method 2023-11-09T13:51:47.322+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:47 [DEBUG] TERRAFORM-4-TESTING: Read finished successfully 2023-11-09T13:51:47.323+0300 [DEBUG] State storage statemgr.Filesystem declined to persist a state snapshot 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP Request: PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP Response: 204 204 No Content &{204 No Content 204 HTTP/1.1 1 1 map[Cache-Control:[no-cache] Content-Language:[en] Date:[Thu, 0 9 Nov 2023 10:55:47 GMT] Expires:[Thu, 01 Jan 1970 00:00:01 GMT] Modified:[true] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains] X-Frame-Options:[SAMEORIGIN] X-Ratelimit-Limit:[-1] X-Ratelimit-Remaining:[-1 ] X-Ratelimit-Reset:[1559582945]] {} 0 [] false false map[] 0xc000618600 0xc00073c160} 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP response unique string PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] : Beginning Read 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP request GET mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] Begin Injection 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP request after injection GET mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] Begining DO method https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [TRACE] HTTP Request Method and URL: GET https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [TRACE] HTTP Request Body: 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] Begining DO method https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [TRACE] HTTP Request Method and URL: PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.111+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [TRACE] HTTP Request Body: {[{"op":"add","path":"/sites/5d98502210000038006bd141-Template1/bds/S24-10_246_194/l3Outs/-","value":"MIKROTIK"} ]} 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP Request: PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP Response: 400 400 Bad Request &{400 Bad Request 400 HTTP/1.1 1 1 map[Content-Language:[en] Content-Length:[97] Content-Type:[a pplication/json] Date:[Thu, 09 Nov 2023 10:55:47 GMT] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains] X-Ratelimit-Limit:[-1] X-Ratelimit-Remaining:[-1] X-Ratelimit-Reset:[1559582945]] 0xc0008fc080 97 [] fal se false map[] 0xc000678800 0xc0000bef20} 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP response unique string PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false {"code":141,"mes sage":"Resource Not Found: BdDelta with name S24-10_246_194 not found in List()"} 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] Exit from do method 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] Begining DO method https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [TRACE] HTTP Request Method and URL: PATCH https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8?validate=false 2023-11-09T13:51:48.210+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [TRACE] HTTP Request Body: {[{"op":"add","path":"/sites/5d98502210000038006bd141-Template1/bds/-","value":{"bdRef":{"bdName":"S24-10_246_19 4","schemaId":"5fbb93e4110000a013d41da8","templateName":"Template1"},"hostBasedRouting":true}}]} 2023-11-09T13:51:48.211+0300 [DEBUG] State storage statemgr.Filesystem declined to persist a state snapshot 2023-11-09T13:51:48.211+0300 [ERROR] vertex "mso_schema_site_bd_l3out.site_bd_L3out_x1" error: "Resource Not Found: BdDelta with name S24-10_246_194 not found in List()"{} 2023-11-09T13:51:48.227+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP Request: GET https://xx.xx.xx.xx/mso/api/v1/schemas/5fbb93e4110000a013d41da8 2023-11-09T13:51:48.227+0300 [DEBUG] provider.terraform-provider-mso_v0.11.1: 2023/11/09 13:51:48 [DEBUG] HTTP Response: 200 200 OK &{200 OK 200 HTTP/1.1 1 1 map[Cache-Control:[no-cache] Content-Language:[en] Content-Length:[243571] Cont ent-Type:[application/json] Date:[Thu, 09 Nov 2023 10:55:47 GMT] Expires:[Thu, 01 Jan 1970 00:00:01 GMT] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains] X-Content-Type-Options:[nosniff] X-Frame-Options:[SAM EORIGIN] X-Ratelimit-Limit:[-1] X-Ratelimit-Remaining:[-1] X-Ratelimit-Reset:[1559582945] X-Xss-Protection:[1; mode=block]] 0xc00066b980 243571 [] false false map[] 0xc000618300 0xc00073c160}

akinross commented 1 year ago

Hi @jjman4,

You seem to be hitting dependency issues where site_bd and site_bd_l3out are executing in parallel. If the site_bd_l3out gets executed first the site_bd does not exist yet.

mso_schema_site_bd_l3out.site_bd_L3out_gal: Creating...
mso_schema_template_bd_subnet.bd_sub_terraform: Creating...
mso_schema_site_bd_l3out.site_bd_L3out_ana: Creating...
mso_schema_site_bd.bd_gal: Creating...
mso_schema_site_bd.bd_ana: Creating...

Some reading material I would recommend is:

https://developer.hashicorp.com/terraform/tutorials/configuration-language/dependencies https://developer.hashicorp.com/terraform/internals/graph

jjman4 commented 1 year ago

Hi @akinross i've performed a few apply/destroy and sometimes the "Resource Not Found: BdDelta with name S24-10_246_194 not found in List()" error is still happened.

Enter a value: yes

mso_schema_template_anp.ap_terraform: Creating... mso_schema_template_bd.bd_terraform: Creating... mso_schema_template_anp.ap_terraform: Creation complete after 1s [id=TERRAFORM-4-TESTING] mso_schema_site_anp.ap_X1: Creating... mso_schema_site_anp.ap_X2: Creating... mso_schema_template_bd.bd_terraform: Creation complete after 2s [id=S24-10_246_194] mso_schema_site_bd_l3out.site_bd_L3out_x2: Creating... mso_schema_site_bd.bd_X1: Creating... mso_schema_site_bd.bd_X2: Creating... mso_schema_template_bd_subnet.bd_sub_terraform: Creating... mso_schema_site_bd_l3out.site_bd_L3out_x1: Creating... mso_schema_template_anp_epg.epg_terraform: Creating... mso_schema_site_anp.ap_X1: Creation complete after 2s [id=TERRAFORM-4-TESTING] mso_schema_site_anp.ap_X2: Creation complete after 2s [id=TERRAFORM-4-TESTING] mso_schema_site_bd.bd_X1: Creation complete after 2s [id=S24-10_246_194] mso_schema_template_bd_subnet.bd_sub_terraform: Creation complete after 5s [id=10.246.194.0] mso_schema_template_anp_epg.epg_terraform: Creation complete after 6s [id=TERRAFORM-PREPROD-APP] mso_schema_site_anp_epg.epg_X1: Creating... mso_schema_site_anp_epg.epg_X2: Creating... mso_schema_site_anp_epg_domain.site_epg_terraform_domain_X2: Creating... mso_schema_site_anp_epg_domain.site_epg_terraform_domain_X1: Creating... mso_schema_site_bd.bd_X2: Creation complete after 7s [id=S24-10_246_194] mso_schema_site_bd_l3out.site_bd_L3out_x1: Creation complete after 8s [id=MIKROTIK] mso_schema_site_anp_epg.epg_x1: Creation complete after 2s [id=TERRAFORM-PREPROD-APP] mso_schema_site_anp_epg.epg_x2: Creation complete after 3s [id=TERRAFORM-PREPROD-APP] mso_schema_site_anp_epg_domain.site_epg_terraform_domain_X1: Creation complete after 4s [id=5fbb93e4110000a013d41da8/sites/5d98502210000038006bd141-Template1/anps/TERRAFORM-4-TESTING/epgs/TERRAFORM-PREPROD-APP/domainAssociations/uni/vmmp-VMware/dom-VMM-VDS-X1-02] mso_schema_site_anp_epg_domain.site_epg_terraform_domain_x2: Creation complete after 6s [id=5fbb93e4110000a013d41da8/sites/5d9850730e00003100c40416-Template1/anps/TERRAFORM-4-TESTING/epgs/TERRAFORM-PREPROD-APP/domainAssociations/uni/vmmp-VMware/dom-VMM-VDS-X2-02] ╷ │ Error: "Resource Not Found: BdDelta with name S24-10_246_194 not found in List()"{} │ │ with mso_schema_site_bd_l3out.site_bd_L3out_x2, │ on main.tf line 208, in resource "mso_schema_site_bd_l3out" "site_bd_L3out_x2": │ 208: resource "mso_schema_site_bd_l3out" "site_bd_L3out_x2" {

i've added the depends_on already but still the same

resource "mso_schema_site_bd_l3out" "site_bd_L3out_x1" { schema_id = "${data.mso_schema.pp01_schema.id}" template_name = "${data.mso_schema_template.pp01_schema_template.name}" site_id = "${data.mso_schema_site.schema_site_x1.site_id}" bd_name = "${mso_schema_template_bd.bd_terraform.name}" l3out_name = "MIKROTIK"

depends_on = [mso_schema_template_bd.bd_terraform] }

resource "mso_schema_site_bd_l3out" "site_bd_L3out_x2" { schema_id = "${data.mso_schema.pp01_schema.id}" template_name = "${data.mso_schema_template.pp01_schema_template.name}" site_id = "${data.mso_schema_site.schema_site_x2.site_id}" bd_name = "${mso_schema_template_bd.bd_terraform.name}" l3out_name = "MIKROTIK"

depends_on = [mso_schema_template_bd.bd_terraform] }

Any idea? Thank you in advanced.

Br, J.

jjman4 commented 1 year ago

And i found another misbehavior. The Domain+lag are not properly set. When checking in NDO, they are not set. Be noted that this was already properly set prior all the change i've done today.

resource "mso_schema_site_anp_epg_domain" "site_epg_terraform_domain_x2" { schema_id = "${data.mso_schema.pp01_schema.id}" template_name = "${data.mso_schema_template.pp01_schema_template.name}" site_id = "${data.mso_schema_site.schema_site_x2.site_id}" anp_name = "${mso_schema_template_anp.ap_terraform.name}" epg_name = "${mso_schema_template_anp_epg.epg_terraform.name}" domain_dn = "uni/vmmp-VMware/dom-VMM-VDS-X2-02" deploy_immediacy = "lazy" resolution_immediacy = "lazy" vlan_encap_mode = "static" allow_micro_segmentation = false switching_mode = "native" switch_type = "default" port_encap_vlan_type = "vlan" port_encap_vlan = 2124 enhanced_lag_policy_name = "lag01" enhanced_lag_policy_dn = "uni/vmmp-VMware/dom-VMM-VDS-X2-02/vswitchpolcont/enlacplagp-lag01"

akinross commented 1 year ago

Perhaps it is easier to schedule a short call, could you send me an email with your details then we can continue this thread via email/webex.

jjman4 commented 1 year ago

Details shared accros. Thank you in advanced.