Skip to content

Commit

Permalink
Upgrade terraform-plugin-sdk to 2.24.0 (GoogleCloudPlatform#6818)
Browse files Browse the repository at this point in the history
  • Loading branch information
zli82016 authored and Ray Xu committed Dec 5, 2022
1 parent a052d9e commit 356c7d8
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 50 deletions.
20 changes: 20 additions & 0 deletions mmv1/products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ overrides: !ruby/object:Overrides::ResourceOverrides
instance_template_name: "my-instance-template"
target_pool_name: "my-target-pool"
igm_name: "my-igm"
# Add test_vars_overrides and oics_vars_overrides to fix the failing test,
# which is caused by upgradting terraform-plugin-sdk to 2.24.0.
provider_name: "google-beta"
provider_alias: ""
test_vars_overrides:
provider_name: '"google-beta.us-central1"'
provider_alias: '"alias = \"us-central1\""'
oics_vars_overrides:
provider_name: "google-beta"
provider_alias: ""
- !ruby/object:Provider::Terraform::Examples
name: "autoscaler_basic"
primary_resource_id: "foobar"
Expand Down Expand Up @@ -3607,6 +3617,16 @@ overrides: !ruby/object:Overrides::ResourceOverrides
udp500_forwarding_rule_name: "fr-udp500"
udp4500_forwarding_rule_name: "fr-udp4500"
route_name: "route1"
# Add test_vars_overrides and oics_vars_overrides to fix the failing test,
# which is caused by upgradting terraform-plugin-sdk to 2.24.0.
provider_name: "google-beta"
provider_alias: ""
test_vars_overrides:
provider_name: '"google-beta.us-central1"'
provider_alias: '"alias = \"us-central1\""'
oics_vars_overrides:
provider_name: "google-beta"
provider_alias: ""
properties:
targetVpnGateway: !ruby/object:Overrides::Terraform::PropertyOverride
resource: 'VpnGateway'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "google_compute_autoscaler" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>

name = "<%= ctx[:vars]['autoscaler_name'] %>"
zone = "us-central1-f"
Expand All @@ -19,7 +19,7 @@ resource "google_compute_autoscaler" "<%= ctx[:primary_resource_id] %>" {
}

resource "google_compute_instance_template" "default" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>

name = "<%= ctx[:vars]['instance_template_name'] %>"
machine_type = "e2-medium"
Expand All @@ -45,13 +45,13 @@ resource "google_compute_instance_template" "default" {
}

resource "google_compute_target_pool" "default" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>

name = "<%= ctx[:vars]['target_pool_name'] %>"
}

resource "google_compute_instance_group_manager" "default" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>

name = "<%= ctx[:vars]['igm_name'] %>"
zone = "us-central1-f"
Expand All @@ -66,7 +66,7 @@ resource "google_compute_instance_group_manager" "default" {
}

data "google_compute_image" "debian_9" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>

family = "debian-11"
project = "debian-cloud"
Expand All @@ -75,4 +75,5 @@ data "google_compute_image" "debian_9" {
provider "google-beta" {
region = "us-central1"
zone = "us-central1-a"
}
<%= ctx[:vars]['provider_alias']%>
}
5 changes: 0 additions & 5 deletions mmv1/templates/terraform/examples/scan_config_basic.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ resource "google_security_scanner_scan_config" "<%= ctx[:primary_resource_id] %>
starting_urls = ["http://${google_compute_address.scanner_static_ip.address}"]
target_platforms = ["COMPUTE"]
}

provider "google-beta" {
region = "us-central1"
zone = "us-central1-a"
}
17 changes: 9 additions & 8 deletions mmv1/templates/terraform/examples/vpn_tunnel_beta.tf.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "google_compute_vpn_tunnel" "tunnel1" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['vpn_tunnel_name'] %>"
peer_ip = "15.0.0.120"
shared_secret = "a secret message"
Expand All @@ -18,31 +18,31 @@ resource "google_compute_vpn_tunnel" "tunnel1" {
}

resource "google_compute_vpn_gateway" "target_gateway" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['target_vpn_gateway_name'] %>"
network = google_compute_network.network1.id
}

resource "google_compute_network" "network1" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['network_name'] %>"
}

resource "google_compute_address" "vpn_static_ip" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['address_name'] %>"
}

resource "google_compute_forwarding_rule" "fr_esp" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[: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
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['udp500_forwarding_rule_name'] %>"
ip_protocol = "UDP"
port_range = "500"
Expand All @@ -51,7 +51,7 @@ resource "google_compute_forwarding_rule" "fr_udp500" {
}

resource "google_compute_forwarding_rule" "fr_udp4500" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['udp4500_forwarding_rule_name'] %>"
ip_protocol = "UDP"
port_range = "4500"
Expand All @@ -60,7 +60,7 @@ resource "google_compute_forwarding_rule" "fr_udp4500" {
}

resource "google_compute_route" "route1" {
provider = google-beta
provider = <%= ctx[:vars]['provider_name']%>
name = "<%= ctx[:vars]['route_name'] %>"
network = google_compute_network.network1.name
dest_range = "15.0.0.0/24"
Expand All @@ -72,4 +72,5 @@ resource "google_compute_route" "route1" {
provider "google-beta" {
region = "us-central1"
zone = "us-central1-a"
<%= ctx[:vars]['provider_alias']%>
}
12 changes: 6 additions & 6 deletions mmv1/third_party/terraform/go.mod.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/hashstructure v1.1.0
github.com/sirupsen/logrus v1.8.1
Expand Down Expand Up @@ -106,12 +106,12 @@ require (
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hc-install v0.4.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
github.com/hashicorp/hcl/v2 v2.14.1 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.17.2 // indirect
github.com/hashicorp/terraform-exec v0.17.3 // indirect
github.com/hashicorp/terraform-json v0.14.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.10.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.4.1 // indirect
github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
Expand Down Expand Up @@ -190,7 +190,7 @@ require (
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/yeya24/promlinter v0.1.0 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
github.com/zclconf/go-cty v1.11.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
Expand Down
Loading

0 comments on commit 356c7d8

Please sign in to comment.