Skip to content

Can't disable VPC flow logs for subnet #614

@thevops

Description

@thevops

TL;DR

I have enabled VPC flow logs for a subnet using subnet_flow_logs = true, after a few days I wanted to disable this by removing the above line. Terraform didn't detect any changes, so it couldn't disable this.

I also tried: subnet_flow_logs = false and subnet_flow_logs = null - still the same.

Expected behavior

Terraform recognizes the change and adjust subnet configuration by disabling VPC flow logs.

Observed behavior

Terraform doesn't see code changes - No changes. Your infrastructure matches the configuration.

Terraform Configuration

module "network" {
  source  = "terraform-google-modules/network/google"
  version = "10.0.0"

  project_id   = local.project_id
  network_name = local.network_name

  subnets = [
    {
      subnet_name   = local.subnet_name
      subnet_ip     = local.nodes_address_range
      subnet_region = local.region
      # subnet_flow_logs = true # This is what I want to disable

      subnet_private_access = true
    },
  ]

  secondary_ranges = {
    (local.subnet_name) = [
      {
        range_name    = "ip-range-pods"
        ip_cidr_range = local.pods_address_range
      },
      {
        range_name    = "ip-range-svc"
        ip_cidr_range = local.services_address_range
      },
    ]
  }
}

Terraform Version

Terraform v1.5.5
on darwin_arm64

Terraform Provider Versions

.
├── provider[registry.terraform.io/hashicorp/archive] >= 2.4.2, < 3.0.0
├── provider[registry.terraform.io/hashicorp/google] 6.35.0
├── provider[registry.terraform.io/hashicorp/google-beta] 6.35.0

Additional information

Workaround:

I disabled VPC Flow Logs manually in GCP console, and removed subnet_flow_logs = true from the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions