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

Unable to reference an origin bucket that does not existing yet #270

Open
tms0 opened this issue May 11, 2023 · 0 comments
Open

Unable to reference an origin bucket that does not existing yet #270

tms0 opened this issue May 11, 2023 · 0 comments
Labels
bug 🐛 An issue with the system

Comments

@tms0
Copy link

tms0 commented May 11, 2023

Describe the Bug

I need to create the bucket outside of this module (because I want to customize his name) but when I "terraform plan", it fails with these errors:

╷
│ Error: Invalid count argument
│ 
│   on .terraform/modules/example_cdn/main.tf line 258, in resource "aws_s3_bucket" "origin":
│  258:   count = local.create_s3_origin_bucket ? 1 : 0
│ 
│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the
│ resources that the count depends on.
╵
╷
│ Error: Invalid count argument
│ 
│   on .terraform/modules/example_cdn/main.tf line 361, in data "aws_s3_bucket" "origin":
│  361:   count  = local.enabled && (var.origin_bucket != null) ? 1 : 0
│ 
│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the
│ resources that the count depends on.
╵

Expected Behavior

The ability to use a bucket not managed by this module, but without having it already created.

Steps to Reproduce

# Does not exist yet
resource "aws_s3_bucket" "example" {
  bucket = "example"
}

module "example_cdn" {
  source  = "cloudposse/cloudfront-s3-cdn/aws"
  version = "0.88.0"

  name                              = "example-cdn"
  origin_bucket                = aws_s3_bucket.example.id
  ...
}

Screenshots

No response

Environment

No response

Additional Context

No response

@tms0 tms0 added the bug 🐛 An issue with the system label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

1 participant