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

Uppercase in prefix value causes validation error on COS bucket name #209

Open
in-1911 opened this issue Sep 18, 2024 · 0 comments
Open
Assignees

Comments

@in-1911
Copy link

in-1911 commented Sep 18, 2024

When a value for the prefix input contains an uppercase characters, the terraform plan fails with a validation error on COS bucket name parameter (even if no COS will be actually provisioned).

...
prefix = "MY-lab-00"
cos_bucket_name = null
provision_atracker_cos = false
cos_instance_name = null
cos_target_name = null
...

Affected modules

Terraform CLI and Terraform provider versions

  • Terraform version:
  • Provider version:

Terraform output

2024/09/18 15:55:23 Terraform plan | Error: Invalid value for variable
 2024/09/18 15:55:23 Terraform plan | 
 2024/09/18 15:55:23 Terraform plan |   on main.tf line 33, in module "account_infrastructure_base":
 2024/09/18 15:55:23 Terraform plan |   33:   cos_bucket_name                      = var.cos_bucket_name == null ? try("${var.prefix}-cos-bucket", "cos-bucket") : var.cos_bucket_name
 2024/09/18 15:55:23 Terraform plan |     ├────────────────
 2024/09/18 15:55:23 Terraform plan |     │ var.cos_bucket_name is "MY-lab-00-cos-bucket"
 2024/09/18 15:55:23 Terraform plan | 
 2024/09/18 15:55:23 Terraform plan | `cos_bucket_name` must match the following regex pattern:
 2024/09/18 15:55:23 Terraform plan | "^[a-z0-9][a-z0-9]+[a-z0-9]$"
 2024/09/18 15:55:23 Terraform plan | 
 2024/09/18 15:55:23 Terraform plan | This was checked by the validation rule at ../../variables.tf:329,3-13.

Debug output

Expected behavior

  • Option 1: add validation to prefix to not allow uppercase characters. However this would affect a lot of other DAs
  • Option 2: convert the bucket name constructed from prefix to lowercase.

Also, if no COS bucket is going to be created, it probably does not make sense to perform the validation anyway, but that would be addressed by a fix from options above.

Actual behavior

Steps to reproduce (including links and screen captures)

  1. Run terraform apply

Anything else


By submitting this issue, you agree to follow our Code of Conduct

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

No branches or pull requests

3 participants