Skip to content

Commit 45c9ac5

Browse files
committed
refactored space to space_id
1 parent 78f47f7 commit 45c9ac5

File tree

7 files changed

+19
-20
lines changed

7 files changed

+19
-20
lines changed

mmv1/products/apigee/Space.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ references:
2020
"Managing Spaces": "https://cloud.google.com/apigee/docs/api-platform/system-administration/spaces/manage-spaces"
2121
api: "https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.spaces"
2222
docs:
23-
base_url: "organizations/{{org_id}}/spaces"
24-
self_link: "organizations/{{org_id}}/spaces/{{name}}"
23+
base_url: "{{org_id}}/spaces"
24+
self_link: "{{org_id}}/spaces/{{name}}"
2525
import_format:
26-
- "organizations/{{org_id}}/spaces/{{name}}"
26+
- "{{org_id}}/spaces/{{name}}"
2727
- "{{org_id}}/{{name}}"
2828
iam_policy:
2929
method_name_separator: ':'
30-
parent_resource_attribute: 'space'
30+
parent_resource_attribute: 'space_id'
3131
fetch_iam_policy_verb: 'GET'
3232
set_iam_policy_verb: 'POST'
3333
wrapped_policy_obj: false
3434
allowed_iam_role: 'roles/apigee.spaceViewer'
3535
examples:
3636
- name: "apigee_space_basic"
37-
primary_resource_id: "apigee_space"
37+
primary_resource_id: "space"
3838
vars:
3939
name: "my-space"
4040
display_name: "My Space"
@@ -60,7 +60,7 @@ properties:
6060
- name: "name"
6161
type: String
6262
description: |
63-
Identifier. Id of the space.
63+
Identifier. Id of the space.
6464
This field is used as the resource name, and must follow AIP-122 guidelines.
6565
output: true
6666
- name: "displayName"

mmv1/templates/terraform/examples/apigee_api_product_space.tf.tmpl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
data "google_client_config" "current" {}
22

33
resource "google_compute_network" "apigee_network" {
4-
name = "apigee-network"
4+
name = "apigee-network-{{index $.Vars "instance_name"}}"
55
}
66

77
resource "google_compute_global_address" "apigee_range" {
@@ -34,14 +34,13 @@ resource "google_apigee_instance" "apigee_instance" {
3434

3535
resource "google_apigee_space" "space" {
3636
org_id = google_apigee_organization.apigee_org.id
37-
name = "{{index $.Vars "space_name"}}"
37+
space_id = "{{index $.Vars "space_name"}}"
3838
display_name = "{{index $.Vars "space_display_name"}}"
3939
}
4040

4141
resource "google_apigee_api_product" "space_api_product" {
4242
org_id = google_apigee_organization.apigee_org.id
43-
space = google_apigee_space.space.name
44-
name = "{{index $.Vars "product_name"}}"
43+
space = google_apigee_space.space.space_id
4544
display_name = "My Space API Product"
4645

4746
approval_type = "auto"

mmv1/templates/terraform/examples/apigee_space_basic.tf.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ resource "google_apigee_organization" "apigee_org" {
2828
resource "google_apigee_space" "space" {
2929
org_id = google_apigee_organization.apigee_org.id
3030
space_id = "{{index $.Vars "name"}}"
31-
name = "organizations/${google_apigee_organization.apigee_org.name}/spaces/{{index $.Vars "name"}}"
3231
display_name = "{{index $.Vars "display_name"}}"
3332
}

mmv1/third_party/terraform/services/apigee/resource_apigee_sharedflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func resourceApigeeSharedFlowDelete(d *schema.ResourceData, meta interface{}) er
349349
}
350350

351351
func resourceApigeeSharedFlowImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
352-
352+
353353
var id string
354354
var err error
355355

mmv1/third_party/terraform/services/apigee/resource_apigee_space_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ import (
88
"github.com/hashicorp/terraform-provider-google/google/envvar"
99
)
1010

11-
func TestAccApigeeSpace_handwritten(t *testing.T) {
11+
func TestAccApigeeSpace_basicTest(t *testing.T) {
1212
t.Parallel()
1313

1414
context := map[string]interface{}{
1515
"org_id": envvar.GetTestOrgFromEnv(t),
1616
"billing_account": envvar.GetTestBillingAccountFromEnv(t),
1717
"space_name": "test-space-" + acctest.RandString(t, 10),
1818
"display_name": "Test Space",
19+
"random_suffix": acctest.RandString(t, 10),
20+
1921
}
2022

2123
acctest.VcrTest(t, resource.TestCase{
@@ -24,7 +26,7 @@ func TestAccApigeeSpace_handwritten(t *testing.T) {
2426
CheckDestroy: testAccCheckApigeeSpaceDestroyProducer(t),
2527
Steps: []resource.TestStep{
2628
{
27-
Config: testAccApigeeSpace_handwrittenConfig(context),
29+
Config: testAccApigeeSpace_basicTest(context),
2830
},
2931
{
3032
ResourceName: "google_apigee_space.primary",
@@ -35,11 +37,11 @@ func TestAccApigeeSpace_handwritten(t *testing.T) {
3537
})
3638
}
3739

38-
func testAccApigeeSpace_handwrittenConfig(context map[string]interface{}) string {
40+
func testAccApigeeSpace_basicTest(context map[string]interface{}) string {
3941
return acctest.Nprintf(`
4042
resource "google_project" "project" {
41-
project_id = "%{org_id}-%{space_name}"
42-
name = "%{org_id}-%{space_name}"
43+
project_id = "tf-test%{random_suffix}"
44+
name = "tf-test%{random_suffix}"
4345
org_id = "%{org_id}"
4446
billing_account = "%{billing_account}"
4547
deletion_policy = "DELETE"
@@ -83,7 +85,6 @@ resource "google_apigee_organization" "apigee_org" {
8385
resource "google_apigee_space" "primary" {
8486
org_id = google_apigee_organization.apigee_org.id
8587
space_id = "%{space_name}"
86-
name = "organizations/${google_apigee_organization.apigee_org.name}/spaces/%{space_name}"
8788
display_name = "%{display_name}"
8889
}
8990
`, context)

mmv1/third_party/terraform/website/docs/r/apigee_api.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following arguments are supported:
5353
(Required)
5454
Path to the config zip bundle.
5555

56-
* `space_id` -
56+
* `space` -
5757
(Optional)
5858
The id of the space.
5959

mmv1/third_party/terraform/website/docs/r/apigee_sharedflow.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The following arguments are supported:
3434
(Required)
3535
Path to the config zip bundle.
3636

37-
* `space_id` -
37+
* `space` -
3838
(Optional)
3939
The id of the space.
4040

0 commit comments

Comments
 (0)