terraform-google-network
terraform-google-network copied to clipboard
Error while Creating a subnet
TL;DR

Expected behavior
As there is an update in the subnet code for filter expression we should be able to enable the flow logs in GCP by setting the filter expression to false.
But receiving an error for purpose and role which I haven't noticed in the previous version with the same config.
Observed behavior
While referring the new version of the subnet (5.1.0) receiving and error for resource "google_compute_subnetwork" "subnetwork"
62: purpose = lookup(each.value, "purpose", null) An argument named "purpose" is not expected here.
63: role = lookup(each.value, "role", null) An argument named "role" is not expected here.
Terraform Configuration
module "subnets" {
source = "terraform-google-modules/network/google//modules/subnets"
version = "5.1.0"
project_id = var.project_id
network_name = var.network_name
subnets = var.subnets
#optional inputs
secondary_ranges = var.secondary_ranges
}
This simple module is working fine, but while referring this module in different repo there is an issue
module "shared_vpc_subnets" {
source = "*******"
count = var.subnet_inputs.create_new_subnets ? 1 : 0
project_id = lookup(var.subnet_inputs, "shared_vpc_project_id")
network_name = lookup(var.subnet_inputs, "shared_vpc_network_name")
subnets = lookup(var.subnet_inputs, "subnets")
secondary_ranges = lookup(var.subnet_inputs, "secondary_subnet_ranges")
}
Terraform Version
terraform {
required_version = ">= 0.13.0"
required_providers {
google = {
source = "hashicorp/google"
version = "<5.0,>= 2.12"
}
}
provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-network:subnets/v5.1.0"
}
}
Additional information
No response
I am having the same issue. Why are purpose and role required?
terraform plan
╷
│ Error: Unsupported argument
│
│ on .terraform/modules/network/modules/subnets/main.tf line 60, in resource "google_compute_subnetwork" "subnetwork":
│ 60: purpose = lookup(each.value, "purpose", null)
│
│ An argument named "purpose" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│ on .terraform/modules/network/modules/subnets/main.tf line 61, in resource "google_compute_subnetwork" "subnetwork":
│ 61: role = lookup(each.value, "role", null)
│
│ An argument named "role" is not expected here.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
@dspeck1 @jhansinaidu What version of the provider are you using?
@bharathkkb terraform { required_version = ">= 0.13.0" required_providers { google = { source = "hashicorp/google" version = "<5.0,>= 2.12" } }
provider_meta "google" { module_name = "blueprints/terraform/terraform-google-network:subnets/v5.1.0" } }
@jhansinaidu could you run a terraform version in your root config (the directory where you run tf apply) and paste the output? #377 should fix the min version for the module but since we allow >=2.12, you should be able to use a newer version in your root config.