Skip to content

Commit

Permalink
Promote VPC Flow Logs Terraform API to GA (#12579)
Browse files Browse the repository at this point in the history
Signed-off-by: alkobi-google <[email protected]>
  • Loading branch information
alkobi-google authored Dec 16, 2024
1 parent 6546636 commit 5e6616b
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 61 deletions.
5 changes: 0 additions & 5 deletions mmv1/products/networkmanagement/VpcFlowLogsConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ name: 'VpcFlowLogsConfig'
description:
VPC Flow Logs Config is a resource that lets you configure
Flow Logs for VPC, Interconnect attachments or VPN Tunnels.
min_version: beta
id_format: 'projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}}'
base_url: 'projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs'
self_link: 'projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}}'
Expand All @@ -41,23 +40,20 @@ custom_code:
examples:
- name: 'network_management_vpc_flow_logs_config_interconnect_full'
primary_resource_id: 'interconnect-test'
min_version: 'beta'
vars:
network_name: 'full-interconnect-test-network'
router_name: 'full-interconnect-test-router'
vpc_flow_logs_config_id: 'full-interconnect-test-id'
interconnect_attachment_name: 'full-interconnect-test-id'
- name: 'network_management_vpc_flow_logs_config_interconnect_basic'
primary_resource_id: 'interconnect-test'
min_version: 'beta'
vars:
network_name: 'basic-interconnect-test-network'
router_name: 'basic-interconnect-test-router'
vpc_flow_logs_config_id: 'basic-interconnect-test-id'
interconnect_attachment_name: 'basic-interconnect-test-id'
- name: 'network_management_vpc_flow_logs_config_vpn_basic'
primary_resource_id: 'vpn-test'
min_version: 'beta'
vars:
network_name: 'basic-test-network'
vpn_tunnel_name: 'basic-test-tunnel'
Expand All @@ -70,7 +66,6 @@ examples:
vpc_flow_logs_config_id: 'basic-test-id'
- name: 'network_management_vpc_flow_logs_config_vpn_full'
primary_resource_id: 'vpn-test'
min_version: 'beta'
vars:
network_name: 'full-test-network'
vpn_tunnel_name: 'full-test-tunnel'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
data "google_project" "project" {
provider = google-beta
}

resource "google_network_management_vpc_flow_logs_config" "{{$.PrimaryResourceId}}" {
provider = google-beta
vpc_flow_logs_config_id = "{{index $.Vars "vpc_flow_logs_config_id"}}"
location = "global"
interconnect_attachment = "projects/${data.google_project.project.number}/regions/us-east4/interconnectAttachments/${google_compute_interconnect_attachment.attachment.name}"
}

resource "google_compute_network" "network" {
provider = google-beta
name = "{{index $.Vars "network_name"}}"
}

resource "google_compute_router" "router" {
provider = google-beta
name = "{{index $.Vars "router_name"}}"
network = google_compute_network.network.name
bgp {
Expand All @@ -24,7 +20,6 @@ resource "google_compute_router" "router" {
}

resource "google_compute_interconnect_attachment" "attachment" {
provider = google-beta
name = "{{index $.Vars "interconnect_attachment_name"}}"
edge_availability_domain = "AVAILABILITY_DOMAIN_1"
type = "PARTNER"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
data "google_project" "project" {
provider = google-beta
}

resource "google_network_management_vpc_flow_logs_config" "{{$.PrimaryResourceId}}" {
provider = google-beta
vpc_flow_logs_config_id = "{{index $.Vars "vpc_flow_logs_config_id"}}"
location = "global"
interconnect_attachment = "projects/${data.google_project.project.number}/regions/us-east4/interconnectAttachments/${google_compute_interconnect_attachment.attachment.name}"
Expand All @@ -15,12 +13,10 @@ resource "google_network_management_vpc_flow_logs_config" "{{$.PrimaryResourceId
}

resource "google_compute_network" "network" {
provider = google-beta
name = "{{index $.Vars "network_name"}}"
}

resource "google_compute_router" "router" {
provider = google-beta
name = "{{index $.Vars "router_name"}}"
network = google_compute_network.network.name
bgp {
Expand All @@ -29,7 +25,6 @@ resource "google_compute_router" "router" {
}

resource "google_compute_interconnect_attachment" "attachment" {
provider = google-beta
name = "{{index $.Vars "interconnect_attachment_name"}}"
edge_availability_domain = "AVAILABILITY_DOMAIN_1"
type = "PARTNER"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
data "google_project" "project" {
provider = google-beta
}

resource "google_network_management_vpc_flow_logs_config" "{{$.PrimaryResourceId}}" {
provider = google-beta
vpc_flow_logs_config_id = "{{index $.Vars "vpc_flow_logs_config_id"}}"
location = "global"
vpn_tunnel = "projects/${data.google_project.project.number}/regions/us-central1/vpnTunnels/${google_compute_vpn_tunnel.tunnel.name}"
}

resource "google_compute_vpn_tunnel" "tunnel" {
provider = google-beta
name = "{{index $.Vars "vpn_tunnel_name"}}"
peer_ip = "15.0.0.120"
shared_secret = "a secret message"
Expand All @@ -24,31 +21,26 @@ resource "google_compute_vpn_tunnel" "tunnel" {
}

resource "google_compute_vpn_gateway" "target_gateway" {
provider = google-beta
name = "{{index $.Vars "target_vpn_gateway_name"}}"
network = google_compute_network.network.id
}

resource "google_compute_network" "network" {
provider = google-beta
name = "{{index $.Vars "network_name"}}"
}

resource "google_compute_address" "vpn_static_ip" {
provider = google-beta
name = "{{index $.Vars "address_name"}}"
}

resource "google_compute_forwarding_rule" "fr_esp" {
provider = google-beta
name = "{{index $.Vars "esp_forwarding_rule_name"}}"
ip_protocol = "ESP"
ip_address = google_compute_address.vpn_static_ip.address
target = google_compute_vpn_gateway.target_gateway.id
}

resource "google_compute_forwarding_rule" "fr_udp500" {
provider = google-beta
name = "{{index $.Vars "udp500_forwarding_rule_name"}}"
ip_protocol = "UDP"
port_range = "500"
Expand All @@ -57,7 +49,6 @@ resource "google_compute_forwarding_rule" "fr_udp500" {
}

resource "google_compute_forwarding_rule" "fr_udp4500" {
provider = google-beta
name = "{{index $.Vars "udp4500_forwarding_rule_name"}}"
ip_protocol = "UDP"
port_range = "4500"
Expand All @@ -66,7 +57,6 @@ resource "google_compute_forwarding_rule" "fr_udp4500" {
}

resource "google_compute_route" "route" {
provider = google-beta
name = "{{index $.Vars "route_name"}}"
network = google_compute_network.network.name
dest_range = "15.0.0.0/24"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
data "google_project" "project" {
provider = google-beta
}

resource "google_network_management_vpc_flow_logs_config" "{{$.PrimaryResourceId}}" {
provider = google-beta
vpc_flow_logs_config_id = "{{index $.Vars "vpc_flow_logs_config_id"}}"
location = "global"
vpn_tunnel = "projects/${data.google_project.project.number}/regions/us-central1/vpnTunnels/${google_compute_vpn_tunnel.tunnel.name}"
Expand All @@ -15,7 +13,6 @@ resource "google_network_management_vpc_flow_logs_config" "{{$.PrimaryResourceId
}

resource "google_compute_vpn_tunnel" "tunnel" {
provider = google-beta
name = "{{index $.Vars "vpn_tunnel_name"}}"
peer_ip = "15.0.0.120"
shared_secret = "a secret message"
Expand All @@ -29,31 +26,26 @@ resource "google_compute_vpn_tunnel" "tunnel" {
}

resource "google_compute_vpn_gateway" "target_gateway" {
provider = google-beta
name = "{{index $.Vars "target_vpn_gateway_name"}}"
network = google_compute_network.network.id
}

resource "google_compute_network" "network" {
provider = google-beta
name = "{{index $.Vars "network_name"}}"
}

resource "google_compute_address" "vpn_static_ip" {
provider = google-beta
name = "{{index $.Vars "address_name"}}"
}

resource "google_compute_forwarding_rule" "fr_esp" {
provider = google-beta
name = "{{index $.Vars "esp_forwarding_rule_name"}}"
ip_protocol = "ESP"
ip_address = google_compute_address.vpn_static_ip.address
target = google_compute_vpn_gateway.target_gateway.id
}

resource "google_compute_forwarding_rule" "fr_udp500" {
provider = google-beta
name = "{{index $.Vars "udp500_forwarding_rule_name"}}"
ip_protocol = "UDP"
port_range = "500"
Expand All @@ -62,7 +54,6 @@ resource "google_compute_forwarding_rule" "fr_udp500" {
}

resource "google_compute_forwarding_rule" "fr_udp4500" {
provider = google-beta
name = "{{index $.Vars "udp4500_forwarding_rule_name"}}"
ip_protocol = "UDP"
port_range = "4500"
Expand All @@ -71,7 +62,6 @@ resource "google_compute_forwarding_rule" "fr_udp4500" {
}

resource "google_compute_route" "route" {
provider = google-beta
name = "{{index $.Vars "route_name"}}"
network = google_compute_network.network.name
dest_range = "15.0.0.0/24"
Expand Down
Loading

0 comments on commit 5e6616b

Please sign in to comment.