GoogleCloudPlatform / terraform-validator

Terraform Validator is not an officially supported Google product; it is a library for conversion of Terraform plan data to CAI Assets. If you have been using terraform-validator directly in the past, we recommend migrating to `gcloud beta terraform vet`.
https://cloud.google.com/docs/terraform/policy-validation
Apache License 2.0
438 stars 93 forks source link

Add support of BigTable cluster autoscaling_config for "google_bigtable_instance resource" #1425

Open akhambhala opened 1 year ago

akhambhala commented 1 year ago

Community Note

Description

Add support of BigTable cluster autoscaling_config for google_bigtable_instance resource. We want to add policy to control the max_nodes in autoscaling of BigTable. Is there any other way to read the terraform state json directly? so we can use that until this support is added.

Affected Resource(s)

Resource converter exists?

No

melinath commented 1 year ago

Is there any other way to read the terraform state json directly?

gcloud terraform vet supports Terraform-based constraints: https://cloud.google.com/docs/terraform/policy-validation/create-terraform-constraints

akhambhala commented 1 year ago

@melinath I tried with gcloud beta terraform vet, but same issue, I am not able to access autoscaling_config. Even though its available in tfplan.json. I can see only location, serverNodes, defaultStorageType, name when I print input.review which is supported https://github.com/GoogleCloudPlatform/terraform-validator/blob/main/converters/google/resources/bigtable_cluster.go#L65

Is that mean as of now there is no way to access autoscaling_config, with out adding them in https://github.com/GoogleCloudPlatform/terraform-validator/blob/main/converters/google/resources/bigtable_cluster.go#L65?

melinath commented 1 year ago

The support for Terraform resources in gcloud terraform vet doesn't go through Terraform Validator - it just passes the resource change data directly from your plan file to the validation framework.