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

Added support for adaptive protection to google_compute_security_policy #4846

Conversation

matty-rose
Copy link
Contributor

@matty-rose matty-rose commented Jun 5, 2021

Fixes hashicorp/terraform-provider-google#8984

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)

compute: Added field `adaptive_protection_config` to `google_compute_security_policy` (beta)

@google-cla google-cla bot added the cla: yes label Jun 5, 2021
@modular-magician
Copy link
Collaborator

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

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review.

Thanks for your contribution! A human will be with you soon.

@c2thorn, please review this PR or find an appropriate assignee.

@modular-magician modular-magician requested a review from c2thorn June 5, 2021 05:45
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 37 insertions(+), 24 deletions(-))
Terraform Beta: Diff ( 3 files changed, 163 insertions(+), 24 deletions(-))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=190742"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccComputeBackendService_withSecurityPolicy|TestAccComputeSecurityPolicy_withAdaptiveProtection|TestAccComputeSecurityPolicy_basic|TestAccComputeSecurityPolicy_withRule|TestAccComputeSecurityPolicy_withRuleExpr|TestAccComputeSecurityPolicy_update You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=190743"

Copy link
Member

@c2thorn c2thorn left a comment

Choose a reason for hiding this comment

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

Hey @matty-rose,

Recently we've been wanting to restrict the use of beta APIs in the GA provider. Can we change this to use the appropriate client based on the version? We could use a variable to hold config.NewComputeClient(userAgent) vs config.NewComputeClient(userAgent) or something to that extent.

@matty-rose
Copy link
Contributor Author

@c2thorn that makes a lot of sense, do you have any suggestions/preferences on how to handle all the flatten/expand methods? i.e. just duplicate all methods with both compute and computeBeta type signatures, and generate in a large if/else block?

@c2thorn
Copy link
Member

c2thorn commented Jun 8, 2021

@c2thorn that makes a lot of sense, do you have any suggestions/preferences on how to handle all the flatten/expand methods? i.e. just duplicate all methods with both compute and computeBeta type signatures, and generate in a large if/else block?

Using https://github.com/GoogleCloudPlatform/magic-modules/blob/master/mmv1/third_party/terraform/resources/resource_dataproc_cluster.go.erb as a reference, I believe we may be able to remove the computeBeta part of the import and refer to both clients as compute._ in the flatteners and expanders.

@matty-rose matty-rose force-pushed the security-policy-adaptive-protection branch 2 times, most recently from e63754d to 9eb5017 Compare June 9, 2021 02:35
@matty-rose matty-rose force-pushed the security-policy-adaptive-protection branch from 9eb5017 to 5ad3fe2 Compare June 9, 2021 02:36
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 37 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 164 insertions(+), 8 deletions(-))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=191295"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 36 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 163 insertions(+), 8 deletions(-))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=191295"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 36 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 163 insertions(+), 8 deletions(-))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=191295"

@matty-rose
Copy link
Contributor Author

thanks for that example @c2thorn, have pushed changes and tests are passing locally for both ga and beta providers so hopefully the magician agrees 🤞

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccEventarcTrigger_transport You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=191328"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccEventarcTrigger_transport You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=191329"

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccEventarcTrigger_transport You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=191330"

Copy link
Member

@c2thorn c2thorn left a comment

Choose a reason for hiding this comment

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

Seems good from my end, thanks for bearing with us on this tricky change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for adaptiveProtectionConfig to google_compute_security_policy
3 participants