Skip to content

Commit

Permalink
Merge pull request #1717 from apichick/apigee-module-fix-try
Browse files Browse the repository at this point in the history
Apigee module fix try
  • Loading branch information
apichick authored Oct 1, 2023
2 parents 2ee8f57 + 179d341 commit f0f6996
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
7 changes: 4 additions & 3 deletions modules/apigee/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ resource "google_apigee_envgroup_attachment" "envgroup_attachments" {
envgroup = v2
}
}])...)
envgroup_id = try(google_apigee_envgroup.envgroups[each.value.envgroup].id, each.value.envgroup)
envgroup_id = "${local.org_id}/envgroups/${each.value.envgroup}"
environment = google_apigee_environment.environments[each.value.environment].name
depends_on = [google_apigee_envgroup.envgroups]
}

resource "google_apigee_environment_iam_binding" "binding" {
Expand Down Expand Up @@ -120,8 +121,8 @@ resource "google_apigee_instance_attachment" "instance_attachments" {
}
}])...)
instance_id = google_apigee_instance.instances[each.value.instance].id
environment = try(google_apigee_environment.environments[each.value.environment].name,
"${local.org_id}/environments/${each.value.environment}")
environment = each.value.environment
depends_on = [google_apigee_environment.environments]
}

resource "google_apigee_endpoint_attachment" "endpoint_attachments" {
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/apigee/env_only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

values:
google_apigee_envgroup_attachment.envgroup_attachments["apis-test-test"]:
envgroup_id: test
envgroup_id: organizations/my-project/envgroups/test
environment: apis-test
timeouts: null
google_apigee_environment.environments["apis-test"]:
Expand Down
6 changes: 3 additions & 3 deletions tests/modules/apigee/env_only_with_api_proxy_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

values:
google_apigee_envgroup_attachment.envgroup_attachments["apis-test-test"]:
envgroup_id: test
envgroup_id: organizations/my-project/envgroups/test
environment: apis-test
google_apigee_environment.environments["apis-test"]:
api_proxy_type: PROGRAMMABLE
description: APIs Test
display_name: APIs test
name: apis-test
node_config:
- max_node_count: '5'
min_node_count: '2'
- max_node_count: "5"
min_node_count: "2"
org_id: organizations/my-project

counts:
Expand Down
7 changes: 3 additions & 4 deletions tests/modules/apigee/env_only_with_deployment_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

values:
google_apigee_envgroup_attachment.envgroup_attachments["apis-test-test"]:
envgroup_id: test
envgroup_id: organizations/my-project/envgroups/test
environment: apis-test
timeouts: null
google_apigee_environment.environments["apis-test"]:
Expand All @@ -23,12 +23,11 @@ values:
display_name: APIs test
name: apis-test
node_config:
- max_node_count: '5'
min_node_count: '2'
- max_node_count: "5"
min_node_count: "2"
org_id: organizations/my-project
timeouts: null

counts:
google_apigee_envgroup_attachment: 1
google_apigee_environment: 1

0 comments on commit f0f6996

Please sign in to comment.