Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions mmv1/products/apphub/Boundary.yaml
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
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'
primary_resource_id: 'example'
test_env_vars:
crm_node_project_number: 'PROJECT_NUMBER'
exclude_test: true
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"}}"
}
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)
}
Loading