Skip to content

Commit

Permalink
Fix cloudrun panic by enabling PRC (#2165)
Browse files Browse the repository at this point in the history
This fixes #2155 by enabling
the bridge PlanResourceChange for the resource.

Looks like the problem has something to do with nested labels properties
being accessed:
hashicorp/terraform-provider-google#17756

I believe the domain mapping resource is also affected, so I've enabled
PRC for that too. It is non-trivial to test as it requires a verified
domain in GCP, so I've skipped that.

stacked on #2163
  • Loading branch information
VenelinMartinov authored Jul 8, 2024
1 parent 50657a0 commit e430db0
Show file tree
Hide file tree
Showing 8 changed files with 3,385 additions and 1 deletion.
15 changes: 15 additions & 0 deletions provider/provider_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ func TestExplicitProviderTokenNotPlainText(t *testing.T) {
tokenExport := res.Outputs["token"]
require.True(t, tokenExport.Secret, "token should be marked as secret")
}

func TestCloudrunServicePanicRegress2155(t *testing.T) {
if testing.Short() {
t.Skipf("Skipping in testing.Short() mode, assuming this is a CI run without GCP creds")
}

cwd, err := os.Getwd()
require.NoError(t, err)
test := pulumitest.NewPulumiTest(t, filepath.Join("test-programs", "cloudrun-service"),
opttest.LocalProviderPath(providerName, filepath.Join(cwd, "..", "bin")),
)

test.Up()
test.Up()
}
4 changes: 3 additions & 1 deletion provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ func Provider() tfbridge.ProviderInfo {
shimv2.WithPlanResourceChange(func(s string) bool {
switch s {
case "google_datastream_connection_profile",
"google_firestore_backup_schedule":
"google_firestore_backup_schedule",
"google_cloud_run_service",
"google_cloud_run_domain_mapping":
return true
default:
return false
Expand Down
2 changes: 2 additions & 0 deletions provider/test-programs/cloudrun-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/node_modules/
7 changes: 7 additions & 0 deletions provider/test-programs/cloudrun-service/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: cloudrun-service
runtime: nodejs
description: A minimal Google Cloud TypeScript Pulumi program
config:
pulumi:tags:
value:
pulumi:template: gcp-typescript
12 changes: 12 additions & 0 deletions provider/test-programs/cloudrun-service/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as gcp from "@pulumi/gcp";

new gcp.cloudrun.Service("my-service", {
location: "us-central1",
template: {
spec: {
containers: [{
image: "us-docker.pkg.dev/cloudrun/container/hello",
}],
},
},
});
Loading

0 comments on commit e430db0

Please sign in to comment.