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

automatic bucket label not sanitized properly #30

Closed
pmarschik opened this issue Dec 19, 2019 · 2 comments
Closed

automatic bucket label not sanitized properly #30

pmarschik opened this issue Dec 19, 2019 · 2 comments

Comments

@pmarschik
Copy link

3e7b600 introduced setting the prefix + name as a bucket label.

However the sanitizing of the name is not complete:

In our case we use a valid DNS name as a bucket name (e.g. host-name.example.com).
This module would then add the label name = host-name.example.com which violates the bucket label constraints.

Steps to reproduce:

module "gcs_terraform_state" {
  source            = "terraform-google-modules/cloud-storage/google"
  version           = "~> 1.0"
  ...
  names             = ["host-name.example.com"]
  ...
}
terraform apply -auto-approve

Result:

[...]
Error: googleapi: Error 400: Invalid argument, invalid

  on .terraform/modules/gcs_terraform_state/terraform-google-modules-terraform-google-cloud-storage-231f6ed/main.tf line 21, in resource "google_storage_bucket" "buckets":
  21: resource "google_storage_bucket" "buckets" {

Expected Result:

[...]
Apply complete! Resources: X added, Y changed, Z destroyed.

Solutions:

  • either properly sanitize the auto-generated label
  • or give an option to disable automatically setting the label
@aaron-lane
Copy link
Contributor

Looks like this may have been fixed by #31.

@bharathkkb
Copy link
Member

Yup looks like it should now change . to -

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

3 participants