terraform-google-modules / terraform-google-network

Sets up a new VPC network on Google Cloud
https://registry.terraform.io/modules/terraform-google-modules/network/google
Apache License 2.0
411 stars 1.23k forks source link

Role values no longer supported #476

Closed montmanu closed 1 year ago

montmanu commented 1 year ago

TL;DR

As of https://github.com/terraform-google-modules/terraform-google-network/pull/467, setting role on a subnets list item is no longer supported despite that usage being included in the README's example.

Expected behavior

No changes detected to the role field of the managed subnet resource after upgrading to 7.2

Observed behavior

State change detected for therole field of the managed subnet resource after upgrading to 7.2.. "ACTIVE" -> null

~ resource "google_compute_subnetwork" "subnetwork" {
    id                         = "projects/***/regions/***/subnetworks/***"
    name                       = "***"
    - role                     = "ACTIVE" -> null
    # (11 unchanged attributes hidden)
}

Terraform Configuration

module "vpc" {
  count = length(var.private_subnets) > 0 ? 1 : 0
  source  = "terraform-google-modules/network/google"
  version = "~> 7.1"
  project_id   = module.project.project_id
  network_name = var.name
  subnets = var.private_subnets # where one of the subnets items here has the `role` field set to `"ACTIVE"`
  secondary_ranges = var.secondary_ranges
}

Terraform Version

$ terraform version
Terraform v1.5.2
on linux_amd64
+ provider registry.terraform.io/datadog/datadog v3.7.0
+ provider registry.terraform.io/hashicorp/google v4.73.1
+ provider registry.terraform.io/hashicorp/google-beta v4.73.1
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/time v0.9.1
+ provider registry.terraform.io/hashicorp/vault v3.1.1

Additional information

May also be an issue for the purpose field (or any other fields that were not included in the new type definition for the subnets variable).

parkedwards commented 1 year ago

we are seeing this as well - one thing im also noticing is that after applying this change (so setting the role value from ACTIVE to null):

saez0pub commented 1 year ago

Hello,

I've also encountered this bug. Waiting for a new release with a fix, I've locked the version to 7.1.0. I've proposed the PR #479 , I hope it will be accepted 🤞.

imrannayer commented 1 year ago

@montmanu @saez0pub @parkedwards This is fixed in #481 will be part release 7.2.1.