Open dalabi06 opened 1 week ago
Voting for Prioritization
Volunteering to Work on This Issue
I am seeing this same issue as well when creating aws_s3_bucket_replication_configuration. If I run a plan / apply the second time, it seems to work correctly. Adding a depends on seems to fix the issue.
Hey @dalabi06 👋 Thank you for taking the time to raise this! I'm not sure I follow you in this case. You mentioned that you're referencing aws_s3_bucket.destination.arn
, however, that's not reflected in your sample configuration, which only has interpolations of module.s3_bucket_replica
. Can you supply a bit of additional context, and, if possible, debug logging (redacted as needed)?
Terraform Core Version
1.9.7
AWS Provider Version
5.27.0
Affected Resource(s)
aws_s3_bucket_replication_configuration
Expected Behavior
When referencing the
aws_s3_bucket.destination.arn
in thedepends_on
block, Terraform should automatically recognize the dependency and execute the necessary operations in the correct order without requiring an explicitdepends_on
declaration. The resource creation for the main S3 bucket and its replication should succeed on the first run, ensuring that all dependencies are resolved as intended.Additionally, the configuration should allow for the successful creation of both the primary and replica S3 buckets on the first run without any errors related to the dependency management.
Actual Behavior
During the initial execution of the Terraform configuration, the creation of the S3 bucket and its replica failed due to a dependency issue, despite the correct references being in place. The error message indicated that the
aws_s3_bucket.destination.arn
was not recognized as a dependency, leading to the failure of the provisioning process.However, upon re-running the Terraform configuration, the resources were created successfully without any issues. This inconsistency suggests that Terraform's dependency resolution is not functioning as expected during the first run, requiring an explicit
depends_on
declaration to bypass the issue.Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Apply Terraform Configuration:
terraform apply
Observe the output for any errors during the initial run.Review Results: Take note of the output and any error messages that occur during the first run. The expected behavior is that the resources should be created without errors.
Rerun the
terraform apply
command again:terraform apply
This time, the command should succeed without errors.Verify that the expected resources are created in your AWS account and that no errors are thrown during the second run.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None