-
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
Replace "Pubsub Subscription Different Project" example with making all examples cross-project-friendly #9637
Conversation
PR GoogleCloudPlatform#2342 changed this example from using `id` to `name`, which removed the project ID from the topic. However, the point of this example is to show how to set up a cross-project subscription, so the example no longer works. This change reverts that change from PR GoogleCloudPlatform#2342. Fixes hashicorp/terraform-provider-google#11642. Fixes hashicorp/terraform-provider-google#6024.
Hello! I am a robot. It looks like you are a: Community Contributor @melinath, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
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.
We've actually flipped positions on the question of name
vs id
and now prefer id
in all cases; would you be willing to update the other pubsub subscription examples as well?
@@ -6,5 +6,5 @@ resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { | |||
resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { | |||
project = "<%= ctx[:vars]['subscription_project'] %>" | |||
name = "<%= ctx[:vars]['subscription_name'] %>" | |||
topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.name | |||
topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id |
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.
To make sure this works as expected, could you extend the example to include setting up a second that's being accessed and remove skip_test?
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.
Sorry, I'm not sure what you mean by "a second" here.
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.
wow, yeah, that sentence is incomprehensible - sorry about that! I meant a second project. If we were running this as a test, we'd want to make sure that we were actually setting up a second project (in addition to the default test project) and that the topic was in the other project. Currently the example uses topic-project
but doesn't actually create that project.
But as you pointed out, if the rest of the pubsub documentation uses .id
consistently, then cross-project doesn't need to be documented at all since it won't work differently than the other cases.
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'm not sure I follow your overall suggestion. Are you saying you just think the docs should only document using id
rather than name
? In that case it probably doesn't need to have this example at all (but maybe the text of the topic
option documentation could mention that while you can provide a short name, it's preferred to provide a full id
and the latter is necessary for cross-project subscriptions)?
@@ -6,5 +6,5 @@ resource "google_pubsub_topic" "<%= ctx[:primary_resource_id] %>" { | |||
resource "google_pubsub_subscription" "<%= ctx[:primary_resource_id] %>" { | |||
project = "<%= ctx[:vars]['subscription_project'] %>" | |||
name = "<%= ctx[:vars]['subscription_name'] %>" | |||
topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.name | |||
topic = google_pubsub_topic.<%= ctx[:primary_resource_id] %>.id |
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.
Sorry, I'm not sure what you mean by "a second" here.
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.
just to say it explicitly - it seems like it would make sense to remove this example altogether and update the remaining google_pubsub_subscription examples to use .id
instead of .name
- would you be down to make that change?
OK, how's this look? |
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.
Looks good apart from one typo.
mmv1/templates/terraform/examples/pubsub_subscription_dead_letter.tf.erb
Outdated
Show resolved
Hide resolved
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 3 files changed, 18 insertions(+), 29 deletions(-)) |
Tests analyticsTotal tests: Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccDataprocClusterIamPolicy |
Rerun these tests in REPLAYING mode to catch issues
|
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.
LGTM, thanks!
…ll examples cross-project-friendly (GoogleCloudPlatform#9637) * Fix "Pubsub Subscription Different Project" example PR GoogleCloudPlatform#2342 changed this example from using `id` to `name`, which removed the project ID from the topic. However, the point of this example is to show how to set up a cross-project subscription, so the example no longer works. This change reverts that change from PR GoogleCloudPlatform#2342. Fixes hashicorp/terraform-provider-google#11642. Fixes hashicorp/terraform-provider-google#6024. * Make all examples cross-project-friendly and update topic description * Fix typo --------- Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
…ll examples cross-project-friendly (GoogleCloudPlatform#9637) * Fix "Pubsub Subscription Different Project" example PR GoogleCloudPlatform#2342 changed this example from using `id` to `name`, which removed the project ID from the topic. However, the point of this example is to show how to set up a cross-project subscription, so the example no longer works. This change reverts that change from PR GoogleCloudPlatform#2342. Fixes hashicorp/terraform-provider-google#11642. Fixes hashicorp/terraform-provider-google#6024. * Make all examples cross-project-friendly and update topic description * Fix typo --------- Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
PR #2342 changed this example from using
id
toname
, which removed the project ID from the topic. However, the point of this example is to show how to set up a cross-project subscription, so the example no longer works.This change removes that example and uses the
id
pattern on all the examples, because we don't need a special "cross project" example if the default usage works cross-project. It also expands thetopic
attribute's description.Fixes hashicorp/terraform-provider-google#11642.
Fixes hashicorp/terraform-provider-google#6024.
Release Note Template for Downstream PRs (will be copied)