Skip to content

Commit

Permalink
Add deploymentType and apiProxyType to ApigeeEnvironment (#5884)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuchenma authored Apr 4, 2022
1 parent 6fb57b6 commit 59a8759
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mmv1/products/apigee/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,31 @@ objects:
Description of the environment.
required: false
input: true
- !ruby/object:Api::Type::Enum
name: 'deploymentType'
description: |
Optional. Deployment type supported by the environment. The deployment type can be
set when creating the environment and cannot be changed. When you enable archive
deployment, you will be prevented from performing a subset of actions within the
environment, including:
Managing the deployment of API proxy or shared flow revisions;
Creating, updating, or deleting resource files;
Creating, updating, or deleting target servers.
values:
- "DEPLOYMENT_TYPE_UNSPECIFIED"
- "PROXY"
- "ARCHIVE"
input: true
- !ruby/object:Api::Type::Enum
name: 'apiProxyType'
description: |
Optional. API Proxy type supported by the environment. The type can be set when creating
the Environment and cannot be changed.
values:
- "API_PROXY_TYPE_UNSPECIFIED"
- "PROGRAMMABLE"
- "CONFIGURABLE"
input: true
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Creating an environment':
Expand Down
15 changes: 15 additions & 0 deletions mmv1/products/apigee/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ overrides: !ruby/object:Overrides::ResourceOverrides
skip_docs: true
# Resource creation race
skip_vcr: true
- !ruby/object:Provider::Terraform::Examples
name: "apigee_environment_basic_deployment_apiproxy_type_test"
primary_resource_id: "apigee_environment"
primary_resource_name: "fmt.Sprintf(\"organizations/tf-test%s\", context[\"random_suffix\"]), fmt.Sprintf(\"tf-test%s\", context[\"random_suffix\"])"
test_env_vars:
org_id: :ORG_ID
billing_account: :BILLING_ACCT
skip_docs: true
# Resource creation race
skip_vcr: true
properties:
deploymentType: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
apiProxyType: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
timeouts: !ruby/object:Api::Timeouts
insert_minutes: 30
delete_minutes: 30
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
resource "google_project" "project" {
project_id = "tf-test%{random_suffix}"
name = "tf-test%{random_suffix}"
org_id = "<%= ctx[:test_env_vars]['org_id'] %>"
billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>"
}

resource "google_project_service" "apigee" {
project = google_project.project.project_id
service = "apigee.googleapis.com"
}

resource "google_project_service" "servicenetworking" {
project = google_project.project.project_id
service = "servicenetworking.googleapis.com"
depends_on = [google_project_service.apigee]
}

resource "google_project_service" "compute" {
project = google_project.project.project_id
service = "compute.googleapis.com"
depends_on = [google_project_service.servicenetworking]
}

resource "google_compute_network" "apigee_network" {
name = "apigee-network"
project = google_project.project.project_id
depends_on = [google_project_service.compute]
}

resource "google_compute_global_address" "apigee_range" {
name = "apigee-range"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.apigee_network.id
project = google_project.project.project_id
}

resource "google_service_networking_connection" "apigee_vpc_connection" {
network = google_compute_network.apigee_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.apigee_range.name]
depends_on = [google_project_service.servicenetworking]
}

resource "google_apigee_organization" "apigee_org" {
analytics_region = "us-central1"
project_id = google_project.project.project_id
authorized_network = google_compute_network.apigee_network.id
depends_on = [
google_service_networking_connection.apigee_vpc_connection,
google_project_service.apigee,
]
}

resource "google_apigee_environment" "<%= ctx[:primary_resource_id] %>" {
org_id = google_apigee_organization.apigee_org.id
name = "tf-test%{random_suffix}"
description = "Apigee Environment"
display_name = "environment-1"
deployment_type = "PROXY"
api_proxy_type = "PROGRAMMABLE"
}

0 comments on commit 59a8759

Please sign in to comment.