Skip to content
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

Make ResourcePolicy updatable to avoid recreation of it. #11091

Merged

Conversation

sizzle0121
Copy link
Contributor

The lack of PATCH method results in bugs such as orphaned snapshots when users use Terraform to edit snapshot schedules for disks, since Terraform will plan to delete and recreate a new one, which differs from what we have in our APIs.
Therefore, make ResourcePolicy updatable at resource level to fix that.

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

resource_policy: make the resource updatable.

@github-actions github-actions bot requested a review from trodge July 1, 2024 23:20
Copy link

github-actions bot commented Jul 1, 2024

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

@trodge, 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, 97 insertions(+), 35 deletions(-))
google-beta provider: Diff ( 3 files changed, 158 insertions(+), 36 deletions(-))

Missing test report

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

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

resource "google_compute_resource_policy" "primary" {
  instance_schedule_policy {
    expiration_time = # value needed
    start_time      = # value needed
  }
  snapshot_schedule_policy {
    schedule {
      weekly_schedule {
        day_of_weeks {
          day        = # value needed
          start_time = # value needed
        }
      }
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 966
Passed tests: 890
Skipped tests: 73
Affected tests: 3

Click here to see the affected service packages
  • compute

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
  • TestAccComputeDiskResourcePolicyAttachment_update
  • TestAccComputeDisk_updateResourcePolicies
  • TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

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

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


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeDiskResourcePolicyAttachment_update[Error message] [Debug log]
TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy[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

@sizzle0121 sizzle0121 force-pushed the make-resource-policy-updatable branch from e75740f to 6868e66 Compare July 2, 2024 04:45
@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 ( 3 files changed, 138 insertions(+), 37 deletions(-))
google-beta provider: Diff ( 4 files changed, 199 insertions(+), 38 deletions(-))

Missing test report

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

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

resource "google_compute_resource_policy" "primary" {
  instance_schedule_policy {
    expiration_time = # value needed
    start_time      = # value needed
  }
  snapshot_schedule_policy {
    schedule {
      weekly_schedule {
        day_of_weeks {
          day        = # value needed
          start_time = # value needed
        }
      }
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 966
Passed tests: 891
Skipped tests: 73
Affected tests: 2

Click here to see the affected service packages
  • compute

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
  • TestAccComputeDiskResourcePolicyAttachment_update
  • TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

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

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


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy[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

@sizzle0121
Copy link
Contributor Author

@trodge I believe the failed test is not related to my change, and I didn't add/modify any field for google_compute_resource_policy
Please review, thanks!

Copy link

github-actions bot commented Jul 4, 2024

@trodge 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

github-actions bot commented Jul 8, 2024

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

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.

3 participants