Skip to content

Commit

Permalink
Update Cloud Run v2 tests to make service account with sweepable name (
Browse files Browse the repository at this point in the history
…hashicorp#9620) (hashicorp#16778)

[upstream:0124464a2158773138682030d38e0a454c998238]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Dec 12, 2023
1 parent b6532c0 commit 270ad86
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .changelog/9620.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestAccDataSourceGoogleCloudRunV2Job_bindIAMPermission(t *testing.T) {

project := envvar.GetTestProjectFromEnv()

name := fmt.Sprintf("tf-test-cloud-run-v2-job-%d", acctest.RandInt(t))
name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
location := "us-central1"
id := fmt.Sprintf("projects/%s/locations/%s/jobs/%s", project, location, name)

Expand Down Expand Up @@ -124,18 +124,16 @@ data "google_cloud_run_v2_job" "hello" {
}
resource "google_service_account" "foo" {
account_id = "foo-service-account"
display_name = "foo-service-account"
account_id = "%s"
display_name = "Service account for google_cloud_run_v2_job data source acceptance test "
}
resource "google_cloud_run_v2_job_iam_binding" "foo_run_invoker" {
resource "google_cloud_run_v2_job_iam_member" "foo_run_invoker" {
name = data.google_cloud_run_v2_job.hello.name
location = data.google_cloud_run_v2_job.hello.location
role = "roles/run.invoker"
members = [
"serviceAccount:${google_service_account.foo.email}",
]
member = "serviceAccount:${google_service_account.foo.email}"
}
`, name, location)
`, name, location, name)
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestAccDataSourceGoogleCloudRunV2Service_bindIAMPermission(t *testing.T) {

project := envvar.GetTestProjectFromEnv()

name := fmt.Sprintf("tf-test-cloud-run-v2-service-%d", acctest.RandInt(t))
name := fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
location := "us-central1"
id := fmt.Sprintf("projects/%s/locations/%s/services/%s", project, location, name)

Expand Down Expand Up @@ -110,18 +110,16 @@ data "google_cloud_run_v2_service" "hello" {
}
resource "google_service_account" "foo" {
account_id = "foo-service-account"
display_name = "foo-service-account"
account_id = "%s"
display_name = "Service account for google_cloud_run_v2_service data source acceptance test "
}
resource "google_cloud_run_v2_service_iam_binding" "foo_run_invoker" {
resource "google_cloud_run_v2_service_iam_member" "foo_run_invoker" {
name = data.google_cloud_run_v2_service.hello.name
location = data.google_cloud_run_v2_service.hello.location
role = "roles/run.invoker"
members = [
"serviceAccount:${google_service_account.foo.email}",
]
member = "serviceAccount:${google_service_account.foo.email}"
}
`, name, location)
`, name, location, name)
}

0 comments on commit 270ad86

Please sign in to comment.