Open Preskton opened 5 years ago
Here's an example. In this case I renamed netbox_ipam_ip_address.outside
to netbox_ipam_ip_address.toni-kensa-west-primary-external
. My guess is it 400'd because terraform tried to do to the create before the delete, and the IP address already existed in the VRF.
prestondoster@Presktop:~/go/src/github.com/Preskton/terraform-provider-netbox|master⚡
⇒ terraform apply
netbox_org_tenant_group.splatoon: Refreshing state... (ID: org/tenant-group/8)
netbox_ipam_rir.squidland: Refreshing state... (ID: ipam/rir/23)
netbox_ipam_rir.squid-force: Refreshing state... (ID: ipam/rir/22)
netbox_ipam_vrf.toni-kensa-west: Refreshing state... (ID: ipam/vrf/18)
netbox_ipam_aggregate.splatnet: Refreshing state... (ID: 8)
netbox_org_tenant.octolings: Refreshing state... (ID: org/tenant/14)
netbox_org_tenant.squid-kids: Refreshing state... (ID: org/tenant/15)
netbox_ipam_prefix.toni-kensa-west-primary: Refreshing state... (ID: ipam/prefix/8)
netbox_ipam_prefix.toni-kensa-west-secondary: Refreshing state... (ID: ipam/prefix/7)
netbox_ipam_ip_address.toni-kensa-west-primary-router: Refreshing state... (ID: ipam/ip-address/2)
netbox_ipam_ip_address.outside: Refreshing state... (ID: ipam/ip-address/3)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
- destroy
Terraform will perform the following actions:
- netbox_ipam_ip_address.outside
+ netbox_ipam_ip_address.toni-kensa-west-primary-external
id: <computed>
address: "3.3.3.3/32"
description: "Toni Kensa West Primary External IP"
ip_address_id: <computed>
nat_inside_ip_address_id: "2"
status: "1"
tenant_id: "15"
vrf_id: "18"
Plan: 1 to add, 0 to change, 1 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
netbox_ipam_ip_address.outside: Destroying... (ID: ipam/ip-address/3)
netbox_ipam_ip_address.toni-kensa-west-primary-external: Creating...
address: "" => "3.3.3.3/32"
description: "" => "Toni Kensa West Primary External IP"
ip_address_id: "" => "<computed>"
nat_inside_ip_address_id: "" => "2"
status: "" => "1"
tenant_id: "" => "15"
vrf_id: "" => "18"
netbox_ipam_ip_address.outside: Destruction complete after 0s
Error: Error applying plan:
1 error(s) occurred:
* netbox_ipam_ip_address.toni-kensa-west-primary-external: 1 error(s) occurred:
* netbox_ipam_ip_address.toni-kensa-west-primary-external: unknown error (status 400): {resp:0xc000660750}
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
prestondoster@Presktop:~/go/src/github.com/Preskton/terraform-provider-netbox|master⚡
⇒ terraform apply
netbox_ipam_rir.squid-force: Refreshing state... (ID: ipam/rir/22)
netbox_ipam_rir.squidland: Refreshing state... (ID: ipam/rir/23)
netbox_ipam_vrf.toni-kensa-west: Refreshing state... (ID: ipam/vrf/18)
netbox_org_tenant_group.splatoon: Refreshing state... (ID: org/tenant-group/8)
netbox_org_tenant.squid-kids: Refreshing state... (ID: org/tenant/15)
netbox_org_tenant.octolings: Refreshing state... (ID: org/tenant/14)
netbox_ipam_aggregate.splatnet: Refreshing state... (ID: 8)
netbox_ipam_prefix.toni-kensa-west-secondary: Refreshing state... (ID: ipam/prefix/7)
netbox_ipam_prefix.toni-kensa-west-primary: Refreshing state... (ID: ipam/prefix/8)
netbox_ipam_ip_address.toni-kensa-west-primary-router: Refreshing state... (ID: ipam/ip-address/2)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
+ netbox_ipam_ip_address.toni-kensa-west-primary-external
id: <computed>
address: "3.3.3.3/32"
description: "Toni Kensa West Primary External IP"
ip_address_id: <computed>
nat_inside_ip_address_id: "2"
status: "1"
tenant_id: "15"
vrf_id: "18"
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
netbox_ipam_ip_address.toni-kensa-west-primary-external: Creating...
address: "" => "3.3.3.3/32"
description: "" => "Toni Kensa West Primary External IP"
ip_address_id: "" => "<computed>"
nat_inside_ip_address_id: "" => "2"
status: "" => "1"
tenant_id: "" => "15"
vrf_id: "" => "18"
netbox_ipam_ip_address.toni-kensa-west-primary-external: Creation complete after 0s (ID: ipam/ip-address/4)
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
When creating/updating/deleting resources, I've noticed some strange behavior due to order of operations -- I think. It seems that if you have something like:
A few weird situations end up happening:
terraform apply
ing cleans things up.Todo: Explore, identify, fix.