-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add new resource Boundary for AppHub #15891
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
Merged
zli82016
merged 9 commits into
GoogleCloudPlatform:main
from
diegomguzman-google:feat-add-new-resource-boundary-for-apphub
Dec 23, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b3c9fdb
Add new resource Boundary for AppHub
diegomguzman-google 54925fe
Resolve comments and add boundary basic template.
diegomguzman-google 3942aaf
Resolve comments for Boundary resource.
diegomguzman-google 0c8b932
Fix identation.
diegomguzman-google ed5d7e6
Add async to yaml
diegomguzman-google cb93f09
Add tests for Boundary resource.
diegomguzman-google aa75864
Fix lint.
diegomguzman-google 17f6706
Add Basic example config to update test
diegomguzman-google 76a9ee5
Set location to required
diegomguzman-google File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # Copyright 2025 Google Inc. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| --- | ||
| name: 'Boundary' | ||
| description: 'Application management boundary.' | ||
| references: | ||
| guides: | ||
| 'AppHub': 'https://docs.cloud.google.com/app-hub/docs/' | ||
| api: 'https://docs.cloud.google.com/app-hub/docs/reference/rest/v1/Boundary' | ||
|
|
||
| docs: | ||
| self_link: 'projects/{{project}}/locations/{{location}}/boundary' | ||
| # Singleton resource, point create_url to update_url. | ||
| create_url: 'projects/{{project}}/locations/{{location}}/boundary' | ||
| create_verb: 'PATCH' | ||
| update_url: 'projects/{{project}}/locations/{{location}}/boundary' | ||
| update_verb: 'PATCH' | ||
| exclude_delete: true | ||
| id_format: 'projects/{{project}}/locations/{{location}}/boundary' | ||
| import_format: | ||
| - "projects/{{project}}/locations/{{location}}/boundary" | ||
| autogen_async: true | ||
| async: | ||
| actions: ['create', 'update'] | ||
| type: 'OpAsync' | ||
| operation: | ||
| base_url: '{{op_id}}' | ||
| result: | ||
| resource_inside_response: true | ||
| parameters: | ||
| - name: 'location' | ||
| type: String | ||
| description: 'The location for the Boundary resource. Must be global.' | ||
| url_param_only: true | ||
| immutable: true | ||
| required: true | ||
| properties: | ||
| - name: name | ||
| type: String | ||
| description: |- | ||
| Identifier. The resource name of the boundary. | ||
| Format: "projects/{project}/locations/{{location}}/boundary" | ||
| output: true | ||
| - name: crmNode | ||
zli82016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type: String | ||
| description: |- | ||
| Optional. The resource name of the CRM node being attached to the | ||
| boundary. | ||
| Format: `projects/{project-number}` | ||
| - name: createTime | ||
| type: Time | ||
| description: 'Create time.' | ||
| output: true | ||
| - name: updateTime | ||
| type: Time | ||
| description: ' Update time.' | ||
| output: true | ||
| - name: type | ||
| type: Enum | ||
| description: 'Boundary type.' | ||
| output: true | ||
| enum_values: | ||
| - AUTOMATIC | ||
| - MANUAL | ||
| - MANAGED_AUTOMATIC | ||
|
|
||
| examples: | ||
| - name: 'apphub_boundary_basic' | ||
zli82016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| primary_resource_id: 'example' | ||
| test_env_vars: | ||
| crm_node_project_number: 'PROJECT_NUMBER' | ||
| exclude_test: true | ||
4 changes: 4 additions & 0 deletions
4
mmv1/templates/terraform/examples/apphub_boundary_basic.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| resource "google_apphub_boundary" "{{$.PrimaryResourceId}}" { | ||
| location = "global" | ||
| crm_node = "projects/{{index $.TestEnvVars "crm_node_project_number"}}" | ||
| } |
85 changes: 85 additions & 0 deletions
85
mmv1/third_party/terraform/services/apphub/resource_apphub_boundary_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| package apphub_test | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "log" | ||
| "strconv" | ||
| "strings" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
| "github.com/hashicorp/terraform-plugin-testing/terraform" | ||
|
|
||
| "github.com/hashicorp/terraform-provider-google/google/acctest" | ||
| "github.com/hashicorp/terraform-provider-google/google/envvar" | ||
| "github.com/hashicorp/terraform-provider-google/google/tpgresource" | ||
| transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" | ||
|
|
||
| "google.golang.org/api/googleapi" | ||
| ) | ||
|
|
||
| var ( | ||
| _ = fmt.Sprintf | ||
| _ = log.Print | ||
| _ = strconv.Atoi | ||
| _ = strings.Trim | ||
| _ = time.Now | ||
| _ = resource.TestMain | ||
| _ = terraform.NewState | ||
| _ = envvar.TestEnvVar | ||
| _ = tpgresource.SetLabels | ||
| _ = transport_tpg.Config{} | ||
| _ = googleapi.Error{} | ||
| ) | ||
|
|
||
| func TestAccApphubBoundary_apphubBoundary_update(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| context := map[string]interface{}{ | ||
| "crm_node_project_number": envvar.GetTestProjectNumberFromEnv(), | ||
| "random_suffix": acctest.RandString(t, 10), | ||
| } | ||
|
|
||
| acctest.VcrTest(t, resource.TestCase{ | ||
| PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
| ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
| Steps: []resource.TestStep{ | ||
| { | ||
| Config: testAccApphubBoundary_apphubBoundaryBasicExample(context), | ||
| }, | ||
| { | ||
| ResourceName: "google_apphub_boundary.example", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"location"}, | ||
| }, | ||
| { | ||
| Config: testAccApphubBoundary_apphubBoundaryNoCrmNode(context), | ||
| }, | ||
| { | ||
| ResourceName: "google_apphub_boundary.example", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"location"}, | ||
| }, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func testAccApphubBoundary_apphubBoundaryBasicExample(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` | ||
| resource "google_apphub_boundary" "example" { | ||
| location = "global" | ||
| crm_node = "projects/%{crm_node_project_number}" | ||
| } | ||
| `, context) | ||
| } | ||
|
|
||
| func testAccApphubBoundary_apphubBoundaryNoCrmNode(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` | ||
| resource "google_apphub_boundary" "example" { | ||
| location = "global" | ||
| } | ||
| `, context) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.