Skip to content

Commit

Permalink
Fix post-6.0.0 TGC issues (#11581) (#2735)
Browse files Browse the repository at this point in the history
[upstream:1b55ddfc9c700a45cc366b3262aa10fb3744cbb3]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 30, 2024
1 parent 06050a3 commit f148618
Show file tree
Hide file tree
Showing 42 changed files with 129 additions and 26 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/hcl/v2 v2.20.1
github.com/hashicorp/terraform-json v0.22.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240829230502-f590ae668a68
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240830173451-3e4b099dba8a
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A=
github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c=
github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240829230502-f590ae668a68 h1:3qFBCfB2GyStGriu+WphG4u2PWjS7UlYuK2vmwVeP8I=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240829230502-f590ae668a68/go.mod h1:UweFt1y4JaSHAS8NtceJLCaaMy4j68gJwEo9sCaswG8=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240830173451-3e4b099dba8a h1:NadwY8+nmnq48IZ1+Y6sMs2tcqs+Bih81B2gcvsFztI=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240830173451-3e4b099dba8a/go.mod h1:UweFt1y4JaSHAS8NtceJLCaaMy4j68gJwEo9sCaswG8=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down
10 changes: 9 additions & 1 deletion tfplan2cai/testdata/templates/example_alloydb_instance.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"parent":"//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data":{
"instanceType":"PRIMARY",
"labels": {
"goog-terraform-provisioned": "true"
},
"machineConfig":{
"cpuCount":2
}
Expand All @@ -32,7 +35,12 @@
"initialUser":{
"password":"alloydb-cluster"
},
"network":"default"
"labels": {
"goog-terraform-provisioned": "true"
},
"networkConfig": {
"network":"default"
}
}
},
"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"data": {
"description": "example docker repository",
"format": "DOCKER",
"labels": {
"goog-terraform-provisioned": "true"
},
"mode": "STANDARD_REPOSITORY"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"datasetReference": {
"datasetId": "example_dataset"
},
"labels": {
"goog-terraform-provisioned": "true"
},
"location": "US",
"friendlyName": ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"labels": {
"goog-terraform-provisioned": "true",
"test-name": "test-value"
},
"name": "projects/{{.Provider.project}}/instances/tf-instance"
Expand Down
6 changes: 6 additions & 0 deletions tfplan2cai/testdata/templates/example_cloud_run_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"apiVersion": "domains.cloudrun.com/v1",
"kind": "DomainMapping",
"metadata": {
"labels": {
"goog-terraform-provisioned": "true"
},
"name": "tf-test-domain-meep.gcp.tfacc.hashicorptest.com",
"namespace": "{{.Provider.project}}"
},
Expand All @@ -36,6 +39,9 @@
"kind": "Service",
"metadata": {
"name": "tf-test-cloudrun-srv-beep",
"labels": {
"goog-terraform-provisioned": "true"
},
"namespace": "{{.Provider.project}}"
},
"spec": {
Expand Down
3 changes: 3 additions & 0 deletions tfplan2cai/testdata/templates/example_cloud_run_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"annotations": {
"generated-by": "magic-modules"
},
"labels": {
"goog-terraform-provisioned": "true"
},
"name": "cloudrun-to-get-cai",
"namespace": "{{.Provider.project}}"
},
Expand Down
3 changes: 3 additions & 0 deletions tfplan2cai/testdata/templates/example_cloud_run_v2_job.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"discovery_name":"Job",
"parent":"//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data":{
"labels": {
"goog-terraform-provisioned": "true"
},
"template":{
"template":{
"containers":[
Expand Down
6 changes: 3 additions & 3 deletions tfplan2cai/testdata/templates/example_compute_address.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"address": "10.0.42.42",
"addressType": "INTERNAL",
"name": "my-internal-address",
"labels": {
"goog-terraform-provisioned": "true"
},
"region": "projects/{{.Provider.project}}/global/regions/us-central1"
}
}
Expand All @@ -46,9 +49,6 @@
"logConfig": {
"enable": false
},
"labels": {
"goog-terraform-provisioned": "true"
},
"name": "my-subnet",
"region": "projects/{{.Provider.project}}/global/regions/us-central1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"addressType": "EXTERNAL",
"goog-terraform-provisioned": "true",
"labels": {
"goog-terraform-provisioned": "true"
},
"name": "global-appserver-ip"
}
}
Expand Down
3 changes: 3 additions & 0 deletions tfplan2cai/testdata/templates/example_compute_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"name": "debian-disk",
"labels": {
"goog-terraform-provisioned": "true"
},
"sizeGb": 10,
"sourceImage": "projects/debian-cloud/global/images/debian-8-jessie-v20170523",
"type": "projects/{{.Provider.project}}/zones/us-central1-a/diskTypes/pd-ssd",
Expand Down
16 changes: 15 additions & 1 deletion tfplan2cai/testdata/templates/example_compute_vpn_tunnel.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
[
"foo": "bar",
{
"name":"//compute.googleapis.com/projects/{{.Provider.project}}/regions/us-central1/vpnTunnels/tunnel-1",
"asset_type":"compute.googleapis.com/VpnTunnel",
"resource":{
"version":"v1",
"discovery_document_uri":"https://www.googleapis.com/discovery/v1/apis/compute/beta/rest",
"discovery_name":"VpnTunnel",
"parent":"//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data":{
"ikeVersion":2,
"labels":{
"foo":"bar",
"goog-terraform-provisioned": "true"
},
"name":"tunnel-1",
Expand Down Expand Up @@ -61,6 +72,9 @@
"data":{
"addressType":"EXTERNAL",
"name":"vpn-static-ip",
"labels": {
"goog-terraform-provisioned": "true"
},
"region":"projects/{{.Provider.project}}/global/regions/us-central1"
}
},
Expand Down
3 changes: 3 additions & 0 deletions tfplan2cai/testdata/templates/example_dns_managed_zone.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"nonExistence": "nsec3",
"state": "on"
},
"labels": {
"goog-terraform-provisioned": "true"
},
"name": "publiczone",
"privateVisibilityConfig": {
"networks": []
Expand Down
3 changes: 3 additions & 0 deletions tfplan2cai/testdata/templates/example_filestore_instance.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"name": "share1"
}
],
"labels": {
"goog-terraform-provisioned": "true"
},
"networks": [
{
"connectMode": "DIRECT_PEERING",
Expand Down
3 changes: 2 additions & 1 deletion tfplan2cai/testdata/templates/example_gke_hub_feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"data": {
"fleetDefaultMemberConfig": null,
"labels": {
"foo": "bar"
"foo": "bar",
"goog-terraform-provisioned": "true"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"MY_CF_ENV": "my-cf-env"
},
"labels": {
"goog-terraform-provisioned": "true",
"my-cf-label-value": "my-cf-label-value"
},
"location": "us-east1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
}
},
"labels": {
"foo": "bar",
"goog-terraform-provisioned": "true"
"foo": "bar"
},
"projectId": "{{.Provider.project}}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"data": {
"bigqueryProfile": null,
"displayName": "Connection profile",
"labels": {
"goog-terraform-provisioned": "true"
},
"gcsProfile": {
"bucket": "my-bucket",
"rootPath": "/path"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
},
"description": "Database of postgres",
"friendlyName": "stpostgres",
"labels": {
"goog-terraform-provisioned": "true"
},
"location": "us-central1"
}
},
Expand Down Expand Up @@ -80,7 +83,10 @@
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"bigqueryProfile": {},
"displayName": "Connection profile"
"displayName": "Connection profile",
"labels": {
"goog-terraform-provisioned": "true"
}
}
},
"ancestors": ["organizations/{{.OrgID}}"],
Expand All @@ -97,6 +103,9 @@
"data": {
"bigqueryProfile": null,
"displayName": "Source connection profile",
"labels": {
"goog-terraform-provisioned": "true"
},
"mysqlProfile": {
"port": 3306,
"username": "my-user"
Expand Down Expand Up @@ -125,6 +134,9 @@
}
},
"displayName": "postgres to bigQuery",
"labels": {
"goog-terraform-provisioned": "true"
},
"sourceConfig": {
"mysqlSourceConfig": {
"maxConcurrentBackfillTasks": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
},
"description": "Database of postgres",
"friendlyName": "stpostgres",
"labels": {
"goog-terraform-provisioned": "true"
},
"location": "us-central1"
}
},
Expand Down Expand Up @@ -80,7 +83,10 @@
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"bigqueryProfile": {},
"displayName": "Connection profile"
"displayName": "Connection profile",
"labels": {
"goog-terraform-provisioned": "true"
}
}
},
"ancestors": ["organizations/{{.OrgID}}"],
Expand All @@ -97,6 +103,9 @@
"data": {
"bigqueryProfile": null,
"displayName": "Source connection profile",
"labels": {
"goog-terraform-provisioned": "true"
},
"mysqlProfile": {
"port": 3306,
"username": "my-user"
Expand Down Expand Up @@ -125,6 +134,9 @@
}
},
"displayName": "postgres to bigQuery",
"labels": {
"goog-terraform-provisioned": "true"
},
"sourceConfig": {
"mysqlSourceConfig": {
"maxConcurrentBackfillTasks": 0,
Expand Down
3 changes: 3 additions & 0 deletions tfplan2cai/testdata/templates/example_kms_crypto_key.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"discovery_name": "CryptoKey",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"labels": {
"goog-terraform-provisioned": "true"
},
"purpose": "ENCRYPT_DECRYPT"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"discovery_name": "CryptoKey",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"labels": {
"goog-terraform-provisioned": "true"
},
"purpose": "ENCRYPT_DECRYPT"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"discovery_name": "CryptoKey",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"labels": {
"goog-terraform-provisioned": "true"
},
"purpose": "ENCRYPT_DECRYPT"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"discovery_name": "CryptoKey",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"labels": {
"goog-terraform-provisioned": "true"
},
"purpose": "ENCRYPT_DECRYPT"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"displayName": "monitoring notification channel",
"enabled": true,
"labels": {
"email_address": "[email protected]",
"goog-terraform-provisioned": "true"
"email_address": "[email protected]"
},
"type": "email"
}
Expand Down
1 change: 0 additions & 1 deletion tfplan2cai/testdata/templates/example_project_create.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"data": {
"name": "My Project",
"labels": {
"goog-terraform-provisioned": "true",
"project-label-key-a": "project-label-val-a"
},
"projectId": "{{.Provider.project}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"data": {
"name": "My Project",
"labels": {
"goog-terraform-provisioned": "true",
"project-label-key-a": "project-label-val-a"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"parent": "//cloudresourcemanager.googleapis.com/organizations/unknown",
"data": {
"labels": {
"goog-terraform-provisioned": "true",
"project-label-key-a": "project-label-val-a"
},
"name": "My Project"
Expand Down
Loading

0 comments on commit f148618

Please sign in to comment.