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 global application in Apphub #12017

Merged

Conversation

eshagoel06
Copy link
Member

Add support for global application and validation for location and scope type
FIXES hashicorp/terraform-provider-google#19252

Release Note Template for Downstream PRs (will be copied)

apphub: added `GLOBAL` enum value to `scope.type` field in `google_apphub_application` resource

Copy link

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

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

@github-actions github-actions bot requested a review from c2thorn October 16, 2024 13:02
@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, 85 insertions(+), 5 deletions(-))
google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 22 insertions(+))
Open in Cloud Shell: Diff ( 5 files changed, 110 insertions(+), 2 deletions(-))

2 similar comments
@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, 85 insertions(+), 5 deletions(-))
google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 22 insertions(+))
Open in Cloud Shell: Diff ( 5 files changed, 110 insertions(+), 2 deletions(-))

@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, 85 insertions(+), 5 deletions(-))
google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 22 insertions(+))
Open in Cloud Shell: Diff ( 5 files changed, 110 insertions(+), 2 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 14
Passed tests: 13
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • apphub

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApphubApplication_applicationGlobalBasicExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccApphubApplication_applicationGlobalBasicExample[Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 14
Passed tests: 13
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • apphub

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccApphubApplication_applicationGlobalBasicExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccApphubApplication_applicationGlobalBasicExample[Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 14
Passed tests: 14
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • apphub

🟢 All tests passed!

View the build log

scope_type := diff.Get("scope.0.type")

if scope_type == "GLOBAL" {
if location != "global" {
Copy link
Member

Choose a reason for hiding this comment

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

Would the API give an appropriate error in this case? If so, is there a particular pressure to duplicate this validation in the Terraform provider?

Adding additional validation at this level can lead to instances where the API requirements change but the Terraform providers lag behind.

Copy link
Member Author

Choose a reason for hiding this comment

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

API will give an appropriate error in such case. But we wanted terraform plan to perform validation and catch this error.

}
}
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

we should cover this logic somewhere in a test. If we are going to keep it (see my previous comment), let's add an invalid config in https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/services/apphub/resource_apphub_application_test.go and use ExpectError

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

'location': '"us-east1"'
'scope_type': '"REGIONAL"'
- name: 'application_global_basic'
config_path: 'templates/terraform/examples/apphub_application_basic.tf.tmpl'
Copy link
Member

Choose a reason for hiding this comment

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

is config_path actually necessary here? This is usually just used in for private overrides. I'm assuming other examples of using this were just accidentally copied over from the private repo

Copy link
Member Author

Choose a reason for hiding this comment

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

Have updated basic and full examples to remove config_path. But for *_global_basic , we were intending to use the same config as basic with different values.

@github-actions github-actions bot requested a review from c2thorn October 18, 2024 09:11
@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 ( 4 files changed, 147 insertions(+), 16 deletions(-))
google-beta provider: Diff ( 4 files changed, 147 insertions(+), 16 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 22 insertions(+))
Open in Cloud Shell: Diff ( 12 files changed, 346 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 15
Passed tests: 11
Skipped tests: 0
Affected tests: 4

Click here to see the affected service packages
  • apphub

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
  • TestAccApphubApplication_apphubApplicationBasicExample
  • TestAccApphubApplication_apphubApplicationFullExample
  • TestAccApphubApplication_apphubApplicationGlobalBasicExample
  • TestAccApphubApplication_invalidConfigFails

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccApphubApplication_apphubApplicationBasicExample [Debug log]
TestAccApphubApplication_apphubApplicationFullExample [Debug log]
TestAccApphubApplication_apphubApplicationGlobalBasicExample [Debug log]
TestAccApphubApplication_invalidConfigFails [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

Copy link

@c2thorn This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@c2thorn c2thorn merged commit 17c4060 into GoogleCloudPlatform:main Oct 24, 2024
14 checks passed
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.

Adding support for global application in Apphub
3 participants