I'm trying out terraform to set up an S3 + Cloudfront static site. Initially, I set up the site successfully, following the steps from https://alimac.io/static-websites-with-s3-and-hugo-part-1/
However, afterwards I changed the terraform state backend from local
to s3
Now, when I perform terraform apply
I get the following error:
Error: Error applying plan:
2 error(s) occurred:
* aws_cloudfront_distribution.primary_domain: 1 error(s) occurred:
* aws_cloudfront_distribution.primary_domain: CNAMEAlreadyExists: One or more of the CNAMEs you provided are already associated with a different resource.
status code: 409, request id: <removed>
* aws_cloudfront_distribution.secondary_domain: 1 error(s) occurred:
* aws_cloudfront_distribution.secondary_domain: CNAMEAlreadyExists: One or more of the CNAMEs you provided are already associated with a different resource.
status code: 409, request id: <removed>
Any ideas about why this might be happening and what can I do to fix this issue?