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

Invalid value for variable error - var.cloudfront_geo_restriction_locations #15

Open
david-abn opened this issue Apr 26, 2024 · 1 comment

Comments

@david-abn
Copy link

Problem

  • Receiving error when running terraform plan when using no optional settings.
  • The code that is causing the error:
    condition = length(var.cloudfront_geo_restriction_locations) == 2
  • Default value of cloudfront_geo_restriction_locations if undefined by user is [].

Error Message

│ Error: Invalid value for variable
│ 
│   on .terraform/modules/cloudfront-s3-website/variables.tf line 62:
│   62: variable "cloudfront_geo_restriction_locations" {
│     ├────────────────
│     │ var.cloudfront_geo_restriction_locations is empty tuple
│ 
│ must be a valid ISO 3166-1-alpha-2 code
│ 
│ This was checked by the validation rule at .terraform/modules/cloudfront-s3-website/variables.tf:65,3-13.

Current settings/version

module "cloudfront-s3-website" {
  source      = "chgangaraju/cloudfront-s3-website/aws"
  version     = "1.2.6"
  domain_name = var.domain_name
  cloudfront_geo_restriction_locations  = 
}

Proposed solution

Remove the validation causing the error from these lines.

@david-abn
Copy link
Author

@chgangaraju Can I create a PR to implement the proposed solution?

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

No branches or pull requests

1 participant