From 0387ad1792962c0bc619811cd50d8918ec7f80df Mon Sep 17 00:00:00 2001 From: Carson Dunbar Date: Tue, 19 Nov 2024 17:14:07 +0000 Subject: [PATCH] Add network_profile setting to network, update network resource provider --- main.tf | 1 + modules/vpc/main.tf | 2 ++ modules/vpc/variables.tf | 12 ++++++++++++ modules/vpc/versions.tf | 2 +- variables.tf | 12 ++++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 2dcb49bb..46b1e2f8 100644 --- a/main.tf +++ b/main.tf @@ -30,6 +30,7 @@ module "vpc" { enable_ipv6_ula = var.enable_ipv6_ula internal_ipv6_range = var.internal_ipv6_range network_firewall_policy_enforcement_order = var.network_firewall_policy_enforcement_order + network_profile = var.network_profile } /****************************************** diff --git a/modules/vpc/main.tf b/modules/vpc/main.tf index 2b9019f0..52721b2a 100644 --- a/modules/vpc/main.tf +++ b/modules/vpc/main.tf @@ -18,6 +18,7 @@ VPC configuration *****************************************/ resource "google_compute_network" "network" { + provider = google-beta name = var.network_name auto_create_subnetworks = var.auto_create_subnetworks routing_mode = var.routing_mode @@ -28,6 +29,7 @@ resource "google_compute_network" "network" { enable_ula_internal_ipv6 = var.enable_ipv6_ula internal_ipv6_range = var.internal_ipv6_range network_firewall_policy_enforcement_order = var.network_firewall_policy_enforcement_order + network_profile = var.network_profile } /****************************************** diff --git a/modules/vpc/variables.tf b/modules/vpc/variables.tf index 74e16b11..a8dab8a7 100644 --- a/modules/vpc/variables.tf +++ b/modules/vpc/variables.tf @@ -77,3 +77,15 @@ variable "network_firewall_policy_enforcement_order" { default = null description = "Set the order that Firewall Rules and Firewall Policies are evaluated. Valid values are `BEFORE_CLASSIC_FIREWALL` and `AFTER_CLASSIC_FIREWALL`. (default null or equivalent to `AFTER_CLASSIC_FIREWALL`)" } + +variable "network_profile" { + type = string + default = null + description = <<-EOT + "A full or partial URL of the network profile to apply to this network. + This field can be set only at resource creation time. For example, the + following are valid URLs: + * https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name} + * projects/{projectId}/global/networkProfiles/{network_profile_name} + EOT +} \ No newline at end of file diff --git a/modules/vpc/versions.tf b/modules/vpc/versions.tf index 027e3a16..3df63b96 100644 --- a/modules/vpc/versions.tf +++ b/modules/vpc/versions.tf @@ -24,7 +24,7 @@ terraform { } google-beta = { source = "hashicorp/google-beta" - version = ">= 4.64, < 7" + version = ">= 6.XX, < 7" # TODO Update this once the provider is released (DO NOT MERGE) } } diff --git a/variables.tf b/variables.tf index 76c0bdc3..2d2f59c8 100644 --- a/variables.tf +++ b/variables.tf @@ -199,3 +199,15 @@ variable "network_firewall_policy_enforcement_order" { default = null description = "Set the order that Firewall Rules and Firewall Policies are evaluated. Valid values are `BEFORE_CLASSIC_FIREWALL` and `AFTER_CLASSIC_FIREWALL`. (default null or equivalent to `AFTER_CLASSIC_FIREWALL`)" } + +variable "network_profile" { + type = string + default = null + description = <<-EOT + "A full or partial URL of the network profile to apply to this network. + This field can be set only at resource creation time. For example, the + following are valid URLs: + * https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name} + * projects/{projectId}/global/networkProfiles/{network_profile_name} + EOT +}