Skip to content

feat: add most_recent option to google_compute_image datasource#8309

Merged
NickElliot merged 2 commits into
GoogleCloudPlatform:mainfrom
darkweaver87:feat/datasource-image-most-recent
Jul 14, 2023
Merged

feat: add most_recent option to google_compute_image datasource#8309
NickElliot merged 2 commits into
GoogleCloudPlatform:mainfrom
darkweaver87:feat/datasource-image-most-recent

Conversation

@darkweaver87

@darkweaver87 darkweaver87 commented Jul 11, 2023

Copy link
Copy Markdown
Contributor

This PR aims to add most_recent argument the same way AWS does.

I didn't really find where I could add an example, but here it is:

data "google_compute_image" "image" {
  project     = "debian-cloud"
  filter      = "architecture:amd64"
}
# ==> Error: your filter has returned more than one image or no image. Please refine your filter to return exactly one image

data "google_compute_image" "image" {
  project     = "debian-cloud"
  filter      = "architecture:amd64"
  most_recent = true
}
# ==> debian-12-bookworm-arm64-v20230711

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).
  • 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).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

compute: added `most_recent` argument to `google_compute_image` datasource

@google-cla

google-cla Bot commented Jul 11, 2023

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@modular-magician

Copy link
Copy Markdown
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I've detected that you're a community contributor. @NickElliot, a repository maintainer, has been assigned to assist you and help review your changes.

❓ First time contributing? Click here for more details

Your assigned reviewer will help review your code by:

  • Ensuring it's backwards compatible, covers common error cases, etc.
  • Summarizing the change into a user-facing changelog note.
  • Passes tests, either our "VCR" suite, a set of presubmit tests, or with manual test runs.

You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails.

If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox.


@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jul 11, 2023
@darkweaver87 darkweaver87 force-pushed the feat/datasource-image-most-recent branch from bd5ace1 to 3a22359 Compare July 11, 2023 16:15
@darkweaver87 darkweaver87 force-pushed the feat/datasource-image-most-recent branch from 65e9c7c to 5194a89 Compare July 12, 2023 05:40
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jul 12, 2023

@NickElliot NickElliot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like the build is currently failing due to a missing time import to enable the code you added. Could you include that? Thanks!

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jul 13, 2023
@darkweaver87

Copy link
Copy Markdown
Contributor Author

Hello @NickElliot,

Oh yes! Sorry, I forgot to copy/paste back from my go code to the ruby template 😅

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jul 13, 2023
@modular-magician

Copy link
Copy Markdown
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.

Terraform GA: Diff ( 3 files changed, 72 insertions(+), 1 deletion(-))
Terraform Beta: Diff ( 3 files changed, 72 insertions(+), 1 deletion(-))
TF Conversion: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician

Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 2853
Passed tests 2552
Skipped tests: 297
Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeFirewallPolicyRule_multipleRules|TestAccBigtableAppProfile_bigtableAppProfileSingleclusterExample|TestAccDataSourceComputeImageFilter|TestAccContainerAwsNodePool_BetaBasicHandWritten

Get to know how VCR tests work

@modular-magician

Copy link
Copy Markdown
Collaborator

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

Rerun these tests in REPLAYING mode to catch issues

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


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

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@NickElliot NickElliot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! to @ScottSuarez for final review

@NickElliot NickElliot requested a review from ScottSuarez July 13, 2023 22:34
@ScottSuarez

Copy link
Copy Markdown
Contributor

Looks good to me. @NickElliot can you approve and merge. Merging gets block if there is a requested_changes bit on the pr.

@darkweaver87

Copy link
Copy Markdown
Contributor Author

Many thanks guys ;-)

ericayyliu pushed a commit to ericayyliu/magic-modules that referenced this pull request Jul 26, 2023
wj-chen pushed a commit to wj-chen/magic-modules that referenced this pull request Aug 1, 2023
DanielRieske pushed a commit to bschaatsbergen/magic-modules that referenced this pull request Aug 2, 2023
hao-nan-li pushed a commit to hao-nan-li/magic-modules that referenced this pull request Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants