Skip to content

Commit

Permalink
Stop acc test using authoritative IAM on shared KMS resources (#7208) (
Browse files Browse the repository at this point in the history
…#5167)

* Stop acc test using authoritative IAM on shared KMS resources

* Stop other tests using authoritative IAM on shared KMS resources

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 3, 2023
1 parent ed8bb72 commit c7fea22
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .changelog/7208.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
16 changes: 6 additions & 10 deletions google-beta/resource_eventarc_channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,19 @@ data "google_kms_crypto_key" "key1" {
}
resource "google_kms_crypto_key_iam_binding" "key1_binding" {
resource "google_kms_crypto_key_iam_member" "key1_member" {
crypto_key_id = data.google_kms_crypto_key.key1.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_channel" "primary" {
location = "%{region}"
name = "tf-test-name%{random_suffix}"
crypto_key_name = data.google_kms_crypto_key.key1.id
third_party_provider = "projects/${data.google_project.test_project.project_id}/locations/%{region}/providers/datadog"
depends_on = [google_kms_crypto_key_iam_binding.key1_binding]
depends_on = [google_kms_crypto_key_iam_member.key1_member]
}
`, context)
}
Expand All @@ -145,21 +143,19 @@ data "google_kms_crypto_key" "key2" {
key_ring = data.google_kms_key_ring.test_key_ring.id
}
resource "google_kms_crypto_key_iam_binding" "key2_binding" {
resource "google_kms_crypto_key_iam_member" "key2_member" {
crypto_key_id = data.google_kms_crypto_key.key2.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_channel" "primary" {
location = "%{region}"
name = "tf-test-name%{random_suffix}"
crypto_key_name= data.google_kms_crypto_key.key2.id
third_party_provider = "projects/${data.google_project.test_project.project_id}/locations/%{region}/providers/datadog"
depends_on = [google_kms_crypto_key_iam_binding.key2_binding]
depends_on = [google_kms_crypto_key_iam_member.key2_member]
}
`, context)
}
Expand Down
16 changes: 6 additions & 10 deletions google-beta/resource_eventarc_google_channel_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,18 @@ data "google_kms_crypto_key" "key1" {
key_ring = data.google_kms_key_ring.test_key_ring.id
}
resource "google_kms_crypto_key_iam_binding" "key1_binding" {
resource "google_kms_crypto_key_iam_member" "key1_member" {
crypto_key_id = data.google_kms_crypto_key.key1.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_google_channel_config" "primary" {
location = "%{region}"
name = "projects/%{project_name}/locations/%{region}/googleChannelConfig"
crypto_key_name = data.google_kms_crypto_key.key1.id
depends_on =[google_kms_crypto_key_iam_binding.key1_binding]
depends_on =[google_kms_crypto_key_iam_member.key1_member]
}
`, context)
}
Expand All @@ -138,20 +136,18 @@ data "google_kms_crypto_key" "key2" {
key_ring = data.google_kms_key_ring.test_key_ring.id
}
resource "google_kms_crypto_key_iam_binding" "key2_binding" {
resource "google_kms_crypto_key_iam_member" "key2_member" {
crypto_key_id = data.google_kms_crypto_key.key2.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_google_channel_config" "primary" {
location = "%{region}"
name = "projects/%{project_name}/locations/%{region}/googleChannelConfig"
crypto_key_name = data.google_kms_crypto_key.key2.id
depends_on =[google_kms_crypto_key_iam_binding.key2_binding]
depends_on =[google_kms_crypto_key_iam_member.key2_member]
}
`, context)
}
Expand Down
8 changes: 3 additions & 5 deletions google-beta/resource_eventarc_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,19 @@ data "google_kms_crypto_key" "key1" {
}
resource "google_kms_crypto_key_iam_binding" "key1_binding" {
resource "google_kms_crypto_key_iam_member" "key1_member" {
crypto_key_id = data.google_kms_crypto_key.key1.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_channel" "test_channel" {
location = "%{region}"
name = "tf-test-channel%{random_suffix}"
crypto_key_name = data.google_kms_crypto_key.key1.id
third_party_provider = "projects/${data.google_project.test_project.project_id}/locations/%{region}/providers/datadog"
depends_on = [google_kms_crypto_key_iam_binding.key1_binding]
depends_on = [google_kms_crypto_key_iam_member.key1_member]
}
resource "google_cloud_run_service" "default" {
Expand Down
8 changes: 3 additions & 5 deletions website/docs/r/eventarc_channel.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ data "google_kms_crypto_key" "key" {
key_ring = data.google_kms_key_ring.test_key_ring.id
}
resource "google_kms_crypto_key_iam_binding" "key1_binding" {
resource "google_kms_crypto_key_iam_member" "key1_member" {
crypto_key_id = data.google_kms_crypto_key.key1.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_channel" "primary" {
Expand All @@ -53,7 +51,7 @@ resource "google_eventarc_channel" "primary" {
project = "${data.google_project.test_project.project_id}"
crypto_key_name = "${data.google_kms_crypto_key.key1.id}"
third_party_provider = "projects/${data.google_project.test_project.project_id}/locations/us-west1/providers/datadog"
depends_on = [google_kms_crypto_key_iam_binding.key1_binding]
depends_on = [google_kms_crypto_key_iam_member.key1_member]
}
```

Expand Down
8 changes: 3 additions & 5 deletions website/docs/r/eventarc_google_channel_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,19 @@ data "google_kms_crypto_key" "key" {
key_ring = data.google_kms_key_ring.test_key_ring.id
}
resource "google_kms_crypto_key_iam_binding" "key1_binding" {
resource "google_kms_crypto_key_iam_member" "key1_member" {
crypto_key_id = data.google_kms_crypto_key.key1.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com",
]
member = "serviceAccount:service-${data.google_project.test_project.number}@gcp-sa-eventarc.iam.gserviceaccount.com"
}
resource "google_eventarc_google_channel_config" "primary" {
location = "us-west1"
name = "channel"
project = "${data.google_project.test_project.project_id}"
crypto_key_name = "${data.google_kms_crypto_key.key1.id}"
depends_on = [google_kms_crypto_key_iam_binding.key1_binding]
depends_on = [google_kms_crypto_key_iam_member.key1_member]
}
```

Expand Down

0 comments on commit c7fea22

Please sign in to comment.