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

Add support for Beyondcorp AppConnector resource #6801

Merged

Conversation

palramanathan
Copy link
Contributor

@palramanathan palramanathan commented Nov 9, 2022

Add terraform support for BeyondCorp AppConnector resource (https://cloud.google.com/beyondcorp/docs/reference/rest/v1/projects.locations.appConnectors) and AppGateway resource(https://cloud.google.com/beyondcorp/docs/reference/rest/v1/projects.locations.appGateways). Adding API and Terraforms yamls and couple of examples.

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)

`google_beyondcorp_app_connector`
`google_beyondcorp_app_gateway`

@modular-magician
Copy link
Collaborator

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

I've detected that you're a community contributor. @slevenick, 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
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.

Terraform GA: Diff ( 10 files changed, 1728 insertions(+), 3 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1728 insertions(+), 3 deletions(-))
TF Validator: Diff ( 7 files changed, 494 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 8 files changed, 234 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2237
Passed tests 1991
Skipped tests: 241
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorBasicExample|TestAccBeyondcorpAppConnector_beyondcorpAppConnectorFullExample|TestAccBeyondcorpAppConnectorIamPolicyGenerated|TestAccBeyondcorpAppConnectorIamMemberGenerated|TestAccBeyondcorpAppConnectorIamBindingGenerated

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorBasicExample[Error message] [Debug log]
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorFullExample[Error message] [Debug log]
TestAccBeyondcorpAppConnectorIamPolicyGenerated[Error message] [Debug log]
TestAccBeyondcorpAppConnectorIamMemberGenerated[Error message] [Debug log]
TestAccBeyondcorpAppConnectorIamBindingGenerated[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

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

Terraform GA: Diff ( 7 files changed, 1093 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 7 files changed, 1093 insertions(+), 2 deletions(-))
TF Validator: Diff ( 4 files changed, 145 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 8 files changed, 234 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2234
Passed tests 1989
Skipped tests: 241
Failed tests: 4

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFirebaserulesRelease_BasicRelease|TestAccComputeForwardingRule_update|TestAccBeyondcorpAppConnector_beyondcorpAppConnectorFullExample|TestAccBeyondcorpAppConnector_beyondcorpAppConnectorBasicExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccComputeForwardingRule_update[Debug log]
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorFullExample[Debug log]
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorBasicExample[Debug log]

All tests passed
View the build log or the debug log for each test

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

Terraform GA: Diff ( 11 files changed, 2078 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 11 files changed, 2078 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 255 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 16 files changed, 453 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2239
Passed tests 1996
Skipped tests: 241
Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccBeyondcorpAppGateway_beyondcorpAppGatewayFullExample|TestAccBeyondcorpAppGateway_beyondcorpAppGatewayBasicExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccBeyondcorpAppGateway_beyondcorpAppGatewayFullExample[Debug log]
TestAccBeyondcorpAppGateway_beyondcorpAppGatewayBasicExample[Debug log]

All tests passed
View the build log or the debug log for each test

Copy link
Contributor

@slevenick slevenick left a comment

Choose a reason for hiding this comment

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

Overall looks reasonable, just some notes on cleaning up the api.yaml file

Additionally, you've included info on using PATCH and an update mask to update the resources, can you add a handwritten update test to make sure this works correctly?

base_url: projects/{{project}}/locations/{{region}}/appConnectors
self_link: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
create_url: projects/{{project}}/locations/{{region}}/appConnectors?app_connector_id={{name}}
delete_url: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
Copy link
Contributor

Choose a reason for hiding this comment

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

delete & update URL should be redundant, they can generally be derived from self_link & base_url as long as they are standard (which these are)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in both resources.

mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
description: |
Email address of the service account.
- !ruby/object:Api::Type::Time
name: 'createTime'
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these output only fields useful? We try to omit them when we don't expect any user to use them, like create & update time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I was trying to mimic what the API returns, but if terraform standard is to omit fields users won't use, I will remove a few fields from the response (uid, create_time and update_time).

update_url: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
update_verb: :PATCH
update_mask: true
# iam_policy: !ruby/object:Api::Resource::IamPolicy
Copy link
Contributor

Choose a reason for hiding this comment

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

You can delete these

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

A BeyondCorp AppGateway resource represents a BeyondCorp protected AppGateway to a remote application. It creates
all the necessary GCP components needed for creating a BeyondCorp protected AppGateway. Multiple connectors can be
authorised for a single AppGateway.
min_version: ga
Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded, GA is the "highest" version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
Copy link
Contributor Author

@palramanathan palramanathan left a comment

Choose a reason for hiding this comment

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

Thanks for the review! I will address the comments and update the PR.

base_url: projects/{{project}}/locations/{{region}}/appConnectors
self_link: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
create_url: projects/{{project}}/locations/{{region}}/appConnectors?app_connector_id={{name}}
delete_url: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in both resources.

update_url: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
update_verb: :PATCH
update_mask: true
# iam_policy: !ruby/object:Api::Resource::IamPolicy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
description: |
Email address of the service account.
- !ruby/object:Api::Type::Time
name: 'createTime'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I was trying to mimic what the API returns, but if terraform standard is to omit fields users won't use, I will remove a few fields from the response (uid, create_time and update_time).

A BeyondCorp AppGateway resource represents a BeyondCorp protected AppGateway to a remote application. It creates
all the necessary GCP components needed for creating a BeyondCorp protected AppGateway. Multiple connectors can be
authorised for a single AppGateway.
min_version: ga
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
mmv1/products/beyondcorp/api.yaml Show resolved Hide resolved
2. Setting appGateway resoruce to be non updatable.
3. Added a test to verify update/patch ot app connector
@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.

Terraform GA: Diff ( 12 files changed, 1926 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 12 files changed, 1926 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 235 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 16 files changed, 453 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2240
Passed tests 1994
Skipped tests: 241
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccBeyondcorpAppGateway_beyondcorpAppGatewayFullExample|TestAccBeyondcorpAppGateway_beyondcorpAppGatewayBasicExample|TestAccBeyondcorpAppConnector_beyondcorpAppConnectorUpdateExample|TestAccBeyondcorpAppConnector_beyondcorpAppConnectorBasicExample|TestAccBeyondcorpAppConnector_beyondcorpAppConnectorFullExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccBeyondcorpAppGateway_beyondcorpAppGatewayFullExample[Debug log]
TestAccBeyondcorpAppGateway_beyondcorpAppGatewayBasicExample[Debug log]
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorUpdateExample[Debug log]
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorBasicExample[Debug log]
TestAccBeyondcorpAppConnector_beyondcorpAppConnectorFullExample[Debug log]

All tests passed
View the build log or the debug log for each test

Copy link
Contributor

@slevenick slevenick left a comment

Choose a reason for hiding this comment

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

Thanks looks good!

googlerjk pushed a commit to googlerjk/magic-modules that referenced this pull request Nov 22, 2022
…#6801)

* Add support for Beyondcorp AppConnector resource

* Disabling IAM policy until policy bindings are fixed

* Adding support for Beyondcorp AppGateway resource

* 1. Addressing PR comments
2. Setting appGateway resoruce to be non updatable.
3. Added a test to verify update/patch ot app connector
googlerjk pushed a commit to googlerjk/magic-modules that referenced this pull request Nov 25, 2022
…#6801)

* Add support for Beyondcorp AppConnector resource

* Disabling IAM policy until policy bindings are fixed

* Adding support for Beyondcorp AppGateway resource

* 1. Addressing PR comments
2. Setting appGateway resoruce to be non updatable.
3. Added a test to verify update/patch ot app connector
hao-nan-li pushed a commit to hao-nan-li/magic-modules that referenced this pull request Dec 6, 2022
…#6801)

* Add support for Beyondcorp AppConnector resource

* Disabling IAM policy until policy bindings are fixed

* Adding support for Beyondcorp AppGateway resource

* 1. Addressing PR comments
2. Setting appGateway resoruce to be non updatable.
3. Added a test to verify update/patch ot app connector
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.

3 participants