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

Handle aggregatedList case for generated sweepers #2941

Merged

Conversation

c2thorn
Copy link
Member

@c2thorn c2thorn commented Jan 8, 2020

fixes hashicorp/terraform-provider-google#5300

This PR includes:

  • Removes skip_sweeper flag from resources that use aggregatedList (generates 5 new sweepers)
  • Special case handling within sweeper template for aggregatedList

Edit:
Ran this PR in our CI, you can find the new sweepers running here.

Release Note Template for Downstream PRs (will be copied)


@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, e47130c.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in Inspec.

New Pull Requests

I 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.
depends: hashicorp/terraform-provider-google-beta#1608
depends: hashicorp/terraform-provider-google#5346
depends: ansible-collections/google.cloud#127

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, d290886.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, a21ec40.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

@@ -13,6 +13,12 @@ import (
<%
sweeper_name = product_ns + object.name
wrap_path = object&.nested_query&.keys&.first || object.collection_url_key
listUrlTemplate = object.__product.base_url + object.base_url

listUrlTemplate.sub! "zones/{{zone}}", "aggregated"
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming there's basically no non-GCE zonal resources, so we'll only replace GCE resources with this?

Copy link
Member Author

@c2thorn c2thorn Jan 9, 2020

Choose a reason for hiding this comment

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

Yep, other resources use location/ in the base url and they don't support aggregatedList. I am assuming some consistency in the future, otherwise we will have to use some manual flag.

log.Printf("[INFO] %s resource zone was nil", resourceName)
return nil
}
zoneSegs := strings.Split(obj["zone"].(string),"/")
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't see that helper! I actually do the same thing here to parse the name. I will replace both instances at the same time in a separate PR since it will cause diffs for a ton of existing sweeper files

c2thorn and others added 3 commits January 9, 2020 20:56
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
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.

Generate sweepers for resources that use aggregatedList
4 participants