-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
DistributionAlreadyExists while creating multiple CloudFront distributions #25445
Comments
What's the use case behind this? I'm struggling to think of a reason for creating 5 identical CloudFront Distributions? As far as I know you can't have 2 distributions with the same domain_name but I could be wrong. |
Hey @superuser5 👋 To confirm what @trevorrea mentioned above, the |
as @justinretzolk said you can't create multiple distributions with same domain name according to the docs:
References: |
Stumbled on this while looking into how uniqueness is handled between this module and Cloudfront. From testing, creating multiple identical distributions natively in AWS (i.e. console) works just fine when you are not using alternate domain names. The config above does not have aliases set. Cloudfront generates unique domains names itself for each distribution. The ID is also unique. From https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-distribution.html
The error from @superuser5 is compaining about the |
I just ran into this and it is not because CNAMEAlreadyExists. The TF resource did in fact create the CloudFront distribution, but got confused along the way and lost track of it. My best guess is that it's triggered during rate-limiting. |
Terraform CLI and Terraform AWS Provider Version
./terraform -v
Terraform v1.2.3
on darwin_amd64
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Panic Output
│ Error: error creating CloudFront Distribution: DistributionAlreadyExists: The caller reference that you are using to create a distribution is associated with another distribution. Already exists: E337CUMHPXR6RL
│ status code: 409, request id: df488038-e219-4ed5-bb68-155a02fd7c02
│
Expected Behavior
Multiple distributions are created.
Actual Behavior
╷
│ Error: error creating CloudFront Distribution: DistributionAlreadyExists: The caller reference that you are using to create a distribution is associated with another distribution. Already exists: E337CUMHPXR6RL
│ status code: 409, request id: df488038-e219-4ed5-bb68-155a02fd7c02
│
│ with aws_cloudfront_distribution.server[3],
│ on server_cf.tf line 18, in resource "aws_cloudfront_distribution" "server":
│ 18: resource "aws_cloudfront_distribution" "server" {
Steps to Reproduce
terraform apply
Important Factoids
have custom setup settings
wait_for_deployment = false
count = var.number
retain_on_delete = false
References
The text was updated successfully, but these errors were encountered: