Skip to content

Commit 4ca5ab1

Browse files
Lagu22anoopkverma-google
authored andcommitted
Add properties field to apigee environment resource (GoogleCloudPlatform#12752)
Signed-off-by: Lagu22 <[email protected]>
1 parent b40c5f3 commit 4ca5ab1

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

mmv1/products/apigee/Environment.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ examples:
7979
# Resource creation race
8080
skip_vcr: true
8181
external_providers: ["time"]
82+
- name: 'apigee_environment_basic_properties_test'
83+
primary_resource_id: 'apigee_environment'
84+
primary_resource_name: 'fmt.Sprintf("organizations/tf-test%s", context["random_suffix"]), fmt.Sprintf("tf-test%s", context["random_suffix"])'
85+
test_env_vars:
86+
org_id: 'ORG_ID'
87+
billing_account: 'BILLING_ACCT'
88+
exclude_docs: true
89+
# Resource creation race
90+
skip_vcr: true
91+
external_providers: ["time"]
8292
- name: 'apigee_environment_patch_update_test'
8393
primary_resource_id: 'apigee_environment'
8494
primary_resource_name: 'fmt.Sprintf("organizations/tf-test%s", context["random_suffix"]), fmt.Sprintf("tf-test%s", context["random_suffix"])'
@@ -187,3 +197,23 @@ properties:
187197
description: |
188198
Optional. URI of the forward proxy to be applied to the runtime instances in this environment. Must be in the format of {scheme}://{hostname}:{port}. Note that the scheme must be one of "http" or "https", and the port must be supplied.
189199
required: false
200+
- name: 'properties'
201+
type: NestedObject
202+
description: |
203+
Key-value pairs that may be used for customizing the environment.
204+
properties:
205+
- name: 'property'
206+
type: Array
207+
description: |
208+
List of all properties in the object.
209+
item_type:
210+
type: NestedObject
211+
properties:
212+
- name: 'name'
213+
type: String
214+
description: |
215+
The property key.
216+
- name: 'value'
217+
type: String
218+
description: |
219+
The property value.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
resource "google_project" "project" {
2+
project_id = "tf-test%{random_suffix}"
3+
name = "tf-test%{random_suffix}"
4+
org_id = "{{index $.TestEnvVars "org_id"}}"
5+
billing_account = "{{index $.TestEnvVars "billing_account"}}"
6+
deletion_policy = "DELETE"
7+
}
8+
9+
resource "time_sleep" "wait_60_seconds" {
10+
create_duration = "60s"
11+
depends_on = [google_project.project]
12+
}
13+
14+
resource "google_project_service" "apigee" {
15+
project = google_project.project.project_id
16+
service = "apigee.googleapis.com"
17+
depends_on = [time_sleep.wait_60_seconds]
18+
}
19+
20+
resource "google_project_service" "servicenetworking" {
21+
project = google_project.project.project_id
22+
service = "servicenetworking.googleapis.com"
23+
depends_on = [google_project_service.apigee]
24+
}
25+
26+
resource "google_project_service" "compute" {
27+
project = google_project.project.project_id
28+
service = "compute.googleapis.com"
29+
depends_on = [google_project_service.servicenetworking]
30+
}
31+
32+
resource "google_compute_network" "apigee_network" {
33+
name = "apigee-network"
34+
project = google_project.project.project_id
35+
depends_on = [google_project_service.compute]
36+
}
37+
38+
resource "google_compute_global_address" "apigee_range" {
39+
name = "apigee-range"
40+
purpose = "VPC_PEERING"
41+
address_type = "INTERNAL"
42+
prefix_length = 16
43+
network = google_compute_network.apigee_network.id
44+
project = google_project.project.project_id
45+
}
46+
47+
resource "google_service_networking_connection" "apigee_vpc_connection" {
48+
network = google_compute_network.apigee_network.id
49+
service = "servicenetworking.googleapis.com"
50+
reserved_peering_ranges = [google_compute_global_address.apigee_range.name]
51+
depends_on = [google_project_service.servicenetworking]
52+
}
53+
54+
resource "google_apigee_organization" "apigee_org" {
55+
analytics_region = "us-central1"
56+
project_id = google_project.project.project_id
57+
authorized_network = google_compute_network.apigee_network.id
58+
depends_on = [
59+
google_service_networking_connection.apigee_vpc_connection,
60+
google_project_service.apigee,
61+
]
62+
}
63+
64+
resource "google_apigee_environment" "{{$.PrimaryResourceId}}" {
65+
org_id = google_apigee_organization.apigee_org.id
66+
name = "tf-test%{random_suffix}"
67+
description = "Apigee Environment"
68+
display_name = "environment-1"
69+
properties {
70+
property {
71+
name = "property-1-key"
72+
value = "property-1-value"
73+
}
74+
}
75+
}

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

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ resource "google_apigee_environment" "apigee_environment" {
118118
name = "tf-test%{random_suffix}"
119119
description = "Updated Apigee Environment Description"
120120
display_name = "environment-1-updated"
121+
properties {
122+
property {
123+
name = "property-1-key"
124+
value = "property-1-value"
125+
}
126+
}
121127
}
122128
`, context)
123129
}

0 commit comments

Comments
 (0)