-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not all records created during apply #104
Comments
👋 Hi there - This doesn't sound like an issue with this provider so much as an issue with dependency detection in Terraform. This is likely due to the fact that when Terraform constructs it's dependency graph to figure out the order in which to create resources, it doesn't see any dependency between your records and your zones. Maybe you're already aware, but in case you're not, Terraform provides two ways for you to list a dependency between resources: implicit and explicit. Terraform discovers implicit dependencies when you use an interpolation in a resource configuration that references another resource. If implicit dependencies cannot be used in your configuration, you can create an explicit dependency by using a From your CLI output I can see that you are creating your zones and records in separate modules, so Terraform likely doesn't view these as dependent resources, which leads to the race condition on creation that you're experiencing. Creating dependencies between modules is historically not very straightforward, but there are some workarounds that allow this. I'd recommend reading up on these or restructuring your modules to make denoting these dependencies simpler. |
I counter that I did the same thing and Azure's provider handled it with no issues, and there were most definitely dependencies. I'd upload the config, but need the GPG key mentioned in the "New Issue" text. As for explicitly using |
I can't speak to how this worked for your previous configurations (maybe you were creating implicit dependencies via interpolation), but, as mentioned above, dependency detection (both implicit and explicit) is implemented within Terraform core itself and not the providers. Unfortunately, we have no ability to change this behavior within our provider. Please take a look at How Terraform Works for further info (Construction of the Resource Graph is called out as one of the primary responsibilities of Terraform core). Terraform's documentation on the Resource Graph walks through how Terraform detects the dependencies and constructs the graph. Note that creating edges between the nodes (i.e. ns1 record and zone resources) via implicit or explicit dependencies is the only way to control the order in which Terraform will reach them when it walks the graph to create the resources. Terraform has some useful documentation on module composition that may help you refactor your configuration to get this working the way you want. |
I've taken a look at my previous Azure work and can see how I had a ton of implicit dependencies. I reviewed the documentation on how to use |
Problem Description
When I am trying to build multiple zones with multiple records in a single run, most times, the run will partially fail with errors because one or more zones are not implemented at the time the records for implemented. This is because record creation does not wait for zone creation to be complete before beginning. If I wait a minute or two (or 5), then the zone will be there and the failed-to-be-created records will create just fine.
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Debug Output
https://gist.github.com/chris-zenfolio/16d5dd35c61a3874faec3a72ae841ecc
terraform apply
.https://gist.github.com/chris-zenfolio/41583b21834ad1008b21679ab8483c40
Panic Output
No panic/crash was detected
Expected Behavior
terraform apply
should create/modify all objects in one runActual Behavior
Two runs were needed because record creation did not verify zone existence prior to creation.
Steps to Reproduce
terraform apply
Important Factoids
This implementation is highly iterative. All of the specific information is contained inside the
variables.tf
file.References
I ran similar, highly-iterative, configurations (creating resource groups, vnets, ip addresses, subnets, vpns, etc.) using the azurerm provider that had object-creation dependencies without this particular problem happening.
The text was updated successfully, but these errors were encountered: