-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
aws_route53_zone resource fails when used with count #562
Comments
Is this bug still valid? |
Hi @pawelsocha Meanwhile I can avoid this, if I pass |
I am running into the same issue on Terraform |
+1 |
The fix for this has been merged in via #4341 and will release with v1.17.0 of the AWS provider, likely in a week. |
This has been released in version 1.17.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
Is there a regression with this? I'm on v1.22.0 and having this issue. Setting parallelism to 1 works around the issue. |
Just got this with v1.23 I'm creating within a module a private and a public hosted zone. The module is instantiated four times. The error occurs when creating the four private hosted zones. |
@AlPee-DU can you share your terraform config? |
Module: resource "aws_route53_zone" "pub_zone" {
name = "${var.zone_name}"
}
resource "aws_route53_zone" "prv_zone" {
name = "${var.zone_name}"
vpc_id = "${data.aws_vpc.vpc.id}"
} Main: module "prod_stage" {
source = "module"
zone_name = "prod.${local.domain}"
providers = {
"aws" = "aws.prod"
}
}
module "test_stage" {
source = "module"
zone_name = "test.${local.domain}"
providers = {
"aws" = "aws.test"
}
}
[...] (Also a use case for count in modules 😉) |
And the error is HostedZoneAlreadyExists? |
HostedZoneAlreadyExists: A hosted zone has already been created with the specified caller reference. |
@AlPee-DU you can try resource "aws_route53_zone" "pub_zone" {
name = "${var.zone_name}"
}
resource "aws_route53_zone" "prv_zone" {
name = "${var.zone_name}"
vpc_id = "${data.aws_vpc.vpc.id}"
depends_on = ["aws_route53_zone.pub_zone"]
} |
and I change resource code to create CallerReference using uuid @bflad answer to you - what you think? it's good or no? :-) |
We can switch this to use |
My config already changed... ^^ |
And not to forget: Thanks for the quick response 👍 |
Courtesy of #4903, version 1.25.0 of the AWS provider will use a unique identifier for the |
This has been released in version 1.25.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @nick-o as hashicorp/terraform#12282. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there,
I've run into a strange issue when trying to create multiple Route53 zones via single resource and
count
. It seems that the code to do so only generates a unique caller reference once (see here) which then gets used for multiple API calls.Terraform Version
terraform -v
Terraform v0.8.7
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/nick-o/d0b5a4e7ce5ef4e0ba9d74353daa518e
Panic Output
Expected Behavior
3 Public Route53 Zones should be created
Actual Behavior
Only one zone got created. The other 2 fail to get created due to non-unique caller reference
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
N/A
References
See AWS CLI documentation for explanation of caller-reference. I think the problem stems from trying to create all 3 zones in one go and it will try to use the same caller reference.
The text was updated successfully, but these errors were encountered: