-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pub/Sub Topic CMEK/KMS support #1982
Pub/Sub Topic CMEK/KMS support #1982
Conversation
Acceptance test is currently failing:
I confirm that this is related to the project being created too recently and the gcp-resourceLocations message is unrelated: attempting to create the Topic with a KMS CryptoKey project after a couple of minutes succeeds. I'm not sure how to force a delay in the acceptance tests. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNew Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
Acceptance pass now:
|
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a test failure in CI because of a required permission on the project's PubSub service account. For the test, wdyt about requiring it be preconfigured?
project_id = "%s" | ||
} | ||
resource "google_project_iam_member" "kms-project-binding" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As-is, there's a race condition between the topic and this permission. While we could add this dependency with depends_on
, I'd rather remove it altogether and just rely on the user having configured it in their project. Alternatively, we could add the permission during the kmsKeyBootstrap
function but that isn't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I create projects specifically for the acceptance test to not leave the KMS keys behind, I would prefer to leave the dependency in. I just pushed a change that adds an implicit dependency making the topic project be the IAM member binding, which seems to address the race condition for me. Can we keep this, or does it still trigger the race condition for you (due to the IAM change propagation)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our CI system is a single project so there's a risk of a race condition here, but I don't think the risk is enough to block on. It'll be resolved on next run anyways, so if we actually encounter this flake we can resolve the issue.
@@ -40,6 +40,29 @@ func TestAccPubsubTopic_update(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccPubsubTopic_cmek(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestAccPubsubTopic_cmek(t *testing.T) { | |
// This test requires your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) | |
// to have `roles/cloudkms.cryptoKeyEncrypterDecrypter`. | |
func TestAccPubsubTopic_cmek(t *testing.T) { |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @drebes!
project_id = "%s" | ||
} | ||
resource "google_project_iam_member" "kms-project-binding" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our CI system is a single project so there's a risk of a race condition here, but I don't think the risk is enough to block on. It'll be resolved on next run anyways, so if we actually encounter this flake we can resolve the issue.
…MEK. Co-Authored-By: Riley Karson <[email protected]>
17cf443
to
9ace532
Compare
Release Note for Downstream PRs (will be copied)