Skip to content

Add tags field to Project resource #11440

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

Merged

Conversation

abd-goog
Copy link
Member

@abd-goog abd-goog commented Aug 14, 2024

Add tags field to project resource to allow setting tags on project resources at creation time.
Part of b/330143705

Part of hashicorp/terraform-provider-google#18775

Release Note Template for Downstream PRs (will be copied)

resourcemanager: added `tags` field to `google_project` to allow setting tags for projects at creation time

@abd-goog abd-goog force-pushed the projects-tagging-at-creation branch from 72f6f22 to e798959 Compare August 14, 2024 05:53
@abd-goog abd-goog changed the title Projects Tagging at creation Add tags field to Project resource Aug 14, 2024
@abd-goog abd-goog marked this pull request as ready for review August 14, 2024 05:59
Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@rileykarson, 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.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 82 insertions(+))
google-beta provider: Diff ( 4 files changed, 91 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_project (876 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_project" "primary" {
  tags = # value needed
}

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 91 insertions(+))
google-beta provider: Diff ( 4 files changed, 91 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_project (876 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_project" "primary" {
  tags = # value needed
}

1 similar comment
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 91 insertions(+))
google-beta provider: Diff ( 4 files changed, 91 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_project (876 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_project" "primary" {
  tags = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 145
Passed tests: 114
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccProject_tags

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccProject_tags[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 145
Passed tests: 114
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccProject_tags

Get to know how VCR tests work

@abd-goog
Copy link
Member Author

Tests failed during RECORDING mode: TestAccProject_tags[Error message] [Debug log]

Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@rileykarson The test passes on local, but would need help from TF team to add the tags resource in the test organization and provide tag admin permission to VCR test user.
Or should I mark this test as skipped?

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccProject_tags[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 145
Passed tests: 114
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccProject_tags

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccProject_tags[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create the TagKey inline in the test? We can't scalably manage our environments manually and prefer tests to own their dependencies (and in some rare cases have code to manage bootstrapping them, which this shouldn't need).

@github-actions github-actions bot requested a review from rileykarson August 19, 2024 11:59
@abd-goog
Copy link
Member Author

Can you create the TagKey inline in the test? We can't scalably manage our environments manually and prefer tests to own their dependencies (and in some rare cases have code to manage bootstrapping them, which this shouldn't need).

Hi @rileykarson, I have made changes for inline creation however the test seems to fail in post-destroy because it takes some time for tag binding deletion when delete resource is called...hence delete tag value fails in post test destroy.

Is it necessary to bootstrap in this case?

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 96 insertions(+))
google-beta provider: Diff ( 4 files changed, 96 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_project (868 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_project" "primary" {
  tags = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 145
Passed tests: 114
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccProject_tags

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccProject_tags[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

Copy link

@rileykarson This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccProject_tags[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3921
Passed tests: 3508
Skipped tests: 411
Affected tests: 2

Click here to see the affected service packages

All service packages are affected

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccComputeInstanceTemplate_withNamePrefix
  • TestAccProject_tags

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccProject_tags[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccProjectIamPolicy_invalidMembers[Debug log]
TestAccProject_tags[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Debug log]
TestAccProject_tags[Debug log]
$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@rileykarson rileykarson requested review from zli82016 and removed request for rileykarson August 27, 2024 19:28
@rileykarson
Copy link
Member

Rolling a new reviewer- I've been underwater on reviews, sorry!

@zli82016
Copy link
Member

Can you create the TagKey inline in the test? We can't scalably manage our environments manually and prefer tests to own their dependencies (and in some rare cases have code to manage bootstrapping them, which this shouldn't need).

Hi @rileykarson, I have made changes for inline creation however the test seems to fail in post-destroy because it takes some time for tag binding deletion when delete resource is called...hence delete tag value fails in post test destroy.

Is it necessary to bootstrap in this case?

Do you know how long will the tag binding deletion take? After the project is scheduled to be deleted, when the tags can be deleted by the users?

@abd-goog
Copy link
Member Author

Can you create the TagKey inline in the test? We can't scalably manage our environments manually and prefer tests to own their dependencies (and in some rare cases have code to manage bootstrapping them, which this shouldn't need).

Hi @rileykarson, I have made changes for inline creation however the test seems to fail in post-destroy because it takes some time for tag binding deletion when delete resource is called...hence delete tag value fails in post test destroy.
Is it necessary to bootstrap in this case?

Do you know how long will the tag binding deletion take? After the project is scheduled to be deleted, when the tags can be deleted by the users?

TagBindings can take upto 24 hours or more for automatic deletions(binding deletions triggered by resource deletion).

@github-actions github-actions bot requested a review from rileykarson August 28, 2024 22:41
@abd-goog
Copy link
Member Author

@zli82016 the testing is now supported by bootstrapped tagkeys and tagvalues so the deletion delay isn't an issue anymore.

@zli82016
Copy link
Member

zli82016 commented Aug 28, 2024

Can you create the TagKey inline in the test? We can't scalably manage our environments manually and prefer tests to own their dependencies (and in some rare cases have code to manage bootstrapping them, which this shouldn't need).

Hi @rileykarson, I have made changes for inline creation however the test seems to fail in post-destroy because it takes some time for tag binding deletion when delete resource is called...hence delete tag value fails in post test destroy.
Is it necessary to bootstrap in this case?

Do you know how long will the tag binding deletion take? After the project is scheduled to be deleted, when the tags can be deleted by the users?

TagBindings can take upto 24 hours or more for automatic deletions(binding deletions triggered by resource deletion).

Can you help understand the reason that it takes some time for tagbinding automatic deletion? I just tested it locally. After the project is scheduled to be deleted, the tagbinding can be deleted by calling the API immediately. Some users will complain that they have to wait to delete the tags.

@zli82016
Copy link
Member

@zli82016 the testing is now supported by bootstrapped tagkeys and tagvalues so the deletion delay isn't an issue anymore.

I see, but it is still a concern for the users, as the users have to wait to delete the tags.

@abd-goog
Copy link
Member Author

@zli82016 the testing is now supported by bootstrapped tagkeys and tagvalues so the deletion delay isn't an issue anymore.

I see, but it is still a concern for the users, as the users have to wait to delete the tags.

That is expected product behavior as of now though. So there's nothing that be done from Terraform's end to modify this behavior.
The bindings are deleted by periodic reconciliation and not instantly to avoid some data loss scenarios.

@zli82016
Copy link
Member

zli82016 commented Aug 30, 2024

@zli82016 the testing is now supported by bootstrapped tagkeys and tagvalues so the deletion delay isn't an issue anymore.

I see, but it is still a concern for the users, as the users have to wait to delete the tags.

That is expected product behavior as of now though. So there's nothing that be done from Terraform's end to modify this behavior. The bindings are deleted by periodic reconciliation and not instantly to avoid some data loss scenarios.

Thanks for the information. Do you mind adding a note that the deletion of tagbinding may take some time after the project is scheduled to be deleted in the doc

Also, do you mind adding an example to use the tags to the doc https://github.com/GoogleCloudPlatform/magic-modules/blob/3a8cd91f6603e2b464822646d11cbaab1f2b917f/mmv1/third_party/terraform/website/docs/r/google_project.html.markdown?

Thanks.

@github-actions github-actions bot requested a review from zli82016 September 2, 2024 09:07
@abd-goog
Copy link
Member Author

abd-goog commented Sep 2, 2024

@zli82016 the testing is now supported by bootstrapped tagkeys and tagvalues so the deletion delay isn't an issue anymore.

I see, but it is still a concern for the users, as the users have to wait to delete the tags.

That is expected product behavior as of now though. So there's nothing that be done from Terraform's end to modify this behavior. The bindings are deleted by periodic reconciliation and not instantly to avoid some data loss scenarios.

Thanks for the information. Do you mind adding a note that the deletion of tagbinding may take some time after the project is scheduled to be deleted in the doc

Also, do you mind adding an example to use the tags to the doc https://github.com/GoogleCloudPlatform/magic-modules/blob/3a8cd91f6603e2b464822646d11cbaab1f2b917f/mmv1/third_party/terraform/website/docs/r/google_project.html.markdown?

Thanks.

Added both, PTAL. Thanks.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 237 insertions(+))
google-beta provider: Diff ( 4 files changed, 237 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_project (885 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_project" "primary" {
  tags = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3808
Passed tests: 3394
Skipped tests: 411
Affected tests: 3

Click here to see the affected service packages

All service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccBackupDRBackupVault_fullUpdate
  • TestAccComputeInstanceTemplate_withNamePrefix
  • TestAccDataformRepository_updated

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBackupDRBackupVault_fullUpdate[Debug log]
TestAccComputeInstanceTemplate_withNamePrefix[Debug log]
TestAccDataformRepository_updated[Debug log]
$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccComputeInstanceTemplate_withNamePrefix[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

Copy link
Member

@zli82016 zli82016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zli82016
Copy link
Member

zli82016 commented Sep 3, 2024

The failed tests are unrelated.

@zli82016 zli82016 merged commit 13a8574 into GoogleCloudPlatform:main Sep 3, 2024
10 of 13 checks passed
iyabchen pushed a commit to iyabchen/magic-modules that referenced this pull request Sep 14, 2024
niharika-98 pushed a commit to niharika-98/magic-modules that referenced this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants