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

[proposal] google_compute_resource_policy warn policy name follows regex rule #66

Closed
jlosito opened this issue Jan 7, 2021 · 0 comments · Fixed by #84
Closed

[proposal] google_compute_resource_policy warn policy name follows regex rule #66

jlosito opened this issue Jan 7, 2021 · 0 comments · Fixed by #84
Labels
enhancement New feature or request

Comments

@jlosito
Copy link

jlosito commented Jan 7, 2021

I have a module which looks like the following.

resource "google_compute_resource_policy" "snapshot_policy" {
  name   = "snapshot_policy"
  region = var.gcp_region
  snapshot_schedule_policy {
    schedule {
      hourly_schedule {
        hours_in_cycle = 12
        start_time     = "03:00"
      }
    }
    retention_policy {
      max_retention_days = 61
    }
  }
}

When I try to provision the snapshot policy, I get the following error because the name of the policy does not follow the convention even though a terraform plan does not indicate any error before the apply. It appears that hyphens are prefered rather than underscores in names.

Error: Error creating ResourcePolicy: googleapi: Error 400: Invalid value for field 'resource.name': 'snapshot_policy'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)', invalid

I believe a tflint using the google ruleset does not catch this either.

I'm currently using the latest version of the ruleset from this project and below are the versions of tflint and go I have.

% go version
go version go1.15.6 darwin/amd64

% tflint --version
TFLint version 0.23.0
+ ruleset.google (0.4.0)
@jlosito jlosito changed the title [purposal] google_compute_resource_policy warn policy name follows regex rule [proposal] google_compute_resource_policy warn policy name follows regex rule Jan 7, 2021
@wata727 wata727 added the enhancement New feature or request label Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants