diff --git a/mmv1/templates/terraform/examples/apigee_api_product_with_attributes.tf.tmpl b/mmv1/templates/terraform/examples/apigee_api_product_with_attributes.tf.tmpl index 8c8d1b7b65fe..dd93d80e1623 100644 --- a/mmv1/templates/terraform/examples/apigee_api_product_with_attributes.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_api_product_with_attributes.tf.tmpl @@ -32,6 +32,11 @@ resource "google_apigee_instance" "apigee_instance" { peering_cidr_range = "SLASH_22" } +resource "google_apigee_environment" "env_dev" { + name = "dev" + org_id = google_apigee_organization.apigee_org.id +} + resource "google_apigee_api_product" "full_api_product" { org_id = google_apigee_organization.apigee_org.id name = "{{index $.Vars "product_name"}}" @@ -46,7 +51,7 @@ resource "google_apigee_api_product" "full_api_product" { quota_time_unit = "day" quota_counter_scope = "PROXY" - environments = ["dev", "hom"] + environments = ["dev"] # Set them in reverse order to test set scopes = [ @@ -190,6 +195,7 @@ resource "google_apigee_api_product" "full_api_product" { } depends_on = [ - google_apigee_instance.apigee_instance + google_apigee_instance.apigee_instance, + google_apigee_environment.env_dev ] } diff --git a/mmv1/templates/terraform/examples/apigee_api_product_with_attributes_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_api_product_with_attributes_test.tf.tmpl index ac91919ad5eb..6ed6b4f523be 100644 --- a/mmv1/templates/terraform/examples/apigee_api_product_with_attributes_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_api_product_with_attributes_test.tf.tmpl @@ -73,6 +73,11 @@ resource "google_apigee_instance" "apigee_instance" { peering_cidr_range = "SLASH_22" } +resource "google_apigee_environment" "env_dev" { + name = "dev" + org_id = google_apigee_organization.apigee_org.id +} + resource "google_apigee_api_product" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "full-api-product" @@ -87,7 +92,7 @@ resource "google_apigee_api_product" "{{$.PrimaryResourceId}}" { quota_time_unit = "day" quota_counter_scope = "PROXY" - environments = ["dev", "hom"] + environments = ["dev"] scopes = [ "read:weather", "write:reports" @@ -229,6 +234,7 @@ resource "google_apigee_api_product" "{{$.PrimaryResourceId}}" { } depends_on = [ - google_apigee_instance.apigee_instance + google_apigee_instance.apigee_instance, + google_apigee_environment.env_dev ] } diff --git a/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation.tf.tmpl b/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation.tf.tmpl index ba85ea349890..e20e2ca4a352 100644 --- a/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation.tf.tmpl @@ -32,6 +32,17 @@ resource "google_apigee_instance" "apigee_instance" { peering_cidr_range = "SLASH_22" } +resource "google_apigee_environment" "env_dev" { + name = "dev" + org_id = google_apigee_organization.apigee_org.id +} + +resource "google_apigee_api" "test_apigee_api" { + name = "hello-world" + org_id = google_apigee_organization.apigee_org.name + config_bundle = "apigee_api_bundle.zip" +} + resource "google_apigee_api_product" "full_api_product" { org_id = google_apigee_organization.apigee_org.id name = "{{index $.Vars "product_name"}}" @@ -46,7 +57,7 @@ resource "google_apigee_api_product" "full_api_product" { value = "private" } - environments = ["dev", "hom"] + environments = ["dev"] proxies = ["hello-world"] api_resources = [ "/", @@ -63,6 +74,8 @@ resource "google_apigee_api_product" "full_api_product" { quota_counter_scope = "PROXY" depends_on = [ - google_apigee_instance.apigee_instance + google_apigee_instance.apigee_instance, + google_apigee_environment.env_dev, + google_apigee_api.test_apigee_api ] } diff --git a/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation_test.tf.tmpl b/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation_test.tf.tmpl index 4948c768becb..11de032edfcb 100644 --- a/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation_test.tf.tmpl +++ b/mmv1/templates/terraform/examples/apigee_api_product_with_legacy_operation_test.tf.tmpl @@ -73,6 +73,17 @@ resource "google_apigee_instance" "apigee_instance" { peering_cidr_range = "SLASH_22" } +resource "google_apigee_environment" "env_dev" { + name = "dev" + org_id = google_apigee_organization.apigee_org.id +} + +resource "google_apigee_api" "test_apigee_api" { + name = "hello-world" + org_id = google_apigee_organization.apigee_org.name + config_bundle = "./test-fixtures/apigee_api_bundle.zip" +} + resource "google_apigee_api_product" "{{$.PrimaryResourceId}}" { org_id = google_apigee_organization.apigee_org.id name = "legacy-operation-api-product" @@ -87,7 +98,7 @@ resource "google_apigee_api_product" "{{$.PrimaryResourceId}}" { value = "private" } - environments = ["dev", "hom"] + environments = ["dev"] proxies = ["hello-world"] api_resources = [ "/", @@ -104,6 +115,8 @@ resource "google_apigee_api_product" "{{$.PrimaryResourceId}}" { quota_counter_scope = "PROXY" depends_on = [ - google_apigee_instance.apigee_instance + google_apigee_instance.apigee_instance, + google_apigee_environment.env_dev, + google_apigee_api.test_apigee_api ] } diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_api_product_update_test.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_api_product_update_test.go index fb1cc182568d..e5d3748c3560 100644 --- a/mmv1/third_party/terraform/services/apigee/resource_apigee_api_product_update_test.go +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_api_product_update_test.go @@ -118,6 +118,10 @@ resource "google_apigee_instance" "apigee_instance" { org_id = google_apigee_organization.apigee_org.id peering_cidr_range = "SLASH_22" } +resource "google_apigee_environment" "env_dev" { + name = "dev" + org_id = google_apigee_organization.apigee_org.id +} resource "google_apigee_api_product" "apigee_api_product" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" @@ -132,7 +136,7 @@ resource "google_apigee_api_product" "apigee_api_product" { quota_time_unit = "day" quota_counter_scope = "PROXY" - environments = ["dev", "hom"] + environments = ["dev"] scopes = [ "read:weather", "write:reports" @@ -274,7 +278,8 @@ resource "google_apigee_api_product" "apigee_api_product" { } depends_on = [ - google_apigee_instance.apigee_instance + google_apigee_instance.apigee_instance, + google_apigee_environment.env_dev ] } `, context) @@ -356,6 +361,14 @@ resource "google_apigee_developer" "apigee_developer" { google_apigee_instance.apigee_instance ] } +resource "google_apigee_environment" "env_dev" { + name = "dev" + org_id = google_apigee_organization.apigee_org.id +} +resource "google_apigee_environment" "env_hom" { + name = "hom" + org_id = google_apigee_organization.apigee_org.id +} resource "google_apigee_api_product" "apigee_api_product" { org_id = google_apigee_organization.apigee_org.id name = "tf-test%{random_suffix}" @@ -370,7 +383,7 @@ resource "google_apigee_api_product" "apigee_api_product" { quota_time_unit = "day" quota_counter_scope = "PROXY" - environments = ["dev"] + environments = ["dev", "hom"] scopes = [ "read:weather" ] @@ -511,7 +524,9 @@ resource "google_apigee_api_product" "apigee_api_product" { } depends_on = [ - google_apigee_instance.apigee_instance + google_apigee_instance.apigee_instance, + google_apigee_environment.env_dev, + google_apigee_environment.env_hom ] } `, context)