min_node_count issue with Terraform

Hi,

We have created an environment from Terraform with min_node_count set to 2 and max_node_count set to null.

Every time we run that Terraform it results in that Terraform identifies a change because apparently min_node_count is something else than 2.

 

 

# google_apigee_environment.main["dev-env"] will be updated in-place
  ~ resource "google_apigee_environment" "main" {
        id              = "organizations/[my-org]/environments/dev-env"
        name            = "dev-env"
        # (5 unchanged attributes hidden)

      + node_config {
          + min_node_count = "2"
        }
    }

 

 

and this gives an error because you are not allwed to change it.

 

│ Error: Error updating Environment "organizations/[myorg]/environments/dev-env": googleapi: Error 400: unsupported update mask provided, mask supports updates to fields: [description, display_name, properties, forward_proxy_uri, type]
 
Any suggestion on how to stop this from happening? I tried to get min_node_count but I cant find it in console, using gcloud or using apigeecli.
Solved Solved
4 1 83
1 ACCEPTED SOLUTION

Hello @Bomelin ,

Welcome to Google Cloud Community. Did you've maybe tried use "lifecycle" option as per [1]. and min_node_count parameter ?

resource "some_resource" "example" {
  // Your resource configuration

  lifecycle {
    ignore_changes = [
      // List of attributes for Terraform to ignore changes to
      attribute_name,
    ]
  }
}

  [1.] https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle

cheers,
DamianS

View solution in original post

1 REPLY 1

Hello @Bomelin ,

Welcome to Google Cloud Community. Did you've maybe tried use "lifecycle" option as per [1]. and min_node_count parameter ?

resource "some_resource" "example" {
  // Your resource configuration

  lifecycle {
    ignore_changes = [
      // List of attributes for Terraform to ignore changes to
      attribute_name,
    ]
  }
}

  [1.] https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle

cheers,
DamianS