Skip to content
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

Problem applying module for the first time, datasource uses bucket which is not existing. #31

Closed
maartenvanderhoef opened this issue Nov 2, 2018 · 0 comments · Fixed by #32

Comments

@maartenvanderhoef
Copy link
Contributor

Terraform v0.11.10

  • provider.aws: version = "~> 1.42"

When applying the following:

module "cdn" {
  source           = "git::https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn.git?ref=master"
  namespace        = "eg"
  stage            = "prod"
  name             = "app"
  aliases          = ["xxx]
  parent_zone_name = "xxxxx"
}

I am getting this error:

Error: Error refreshing state: 1 error(s) occurred:

* module.cdn.data.aws_s3_bucket.selected: 1 error(s) occurred:

* module.cdn.data.aws_s3_bucket.selected: data.aws_s3_bucket.selected: Failed getting S3 bucket: NotFound: Not Found
	status code: 404, request id: ED5F22C4A1F1270A, host id: lMLXsPMkwT9+QJ/80X2OeL92PlFeC33QjNdCjNYjez3cP1Km/7A6nBEFeHl59dmdNTMuKDTJQTE= Bucket: "eg-prod-app-origin"

At https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn/blob/f6420b3e81a4c4c2480d6ef429c8651983a57061/main.tf#L100 aws_s3_bucket.origin.*.bucket is used to get the bucket_name, however this will also be evaluated when aws_s3_bucket.origin has not been created yet. That will cause "aws_s3_bucket.selected" to use a bucketname which has not been created yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant