-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add apigee non-vpc peering mode support #1648
Changes from 5 commits
f456754
9451dde
36c707f
7259c0f
28fea9e
4af6ac0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,12 @@ resource "google_apigee_organization" "organization" { | |
count = var.organization == null ? 0 : 1 | ||
analytics_region = var.organization.analytics_region | ||
project_id = var.project_id | ||
authorized_network = var.organization.authorized_network | ||
authorized_network = var.organization.disable_vpc_peering ? null : var.organization.authorized_network | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of changing the value here I'd add validation in the variable ensuring |
||
billing_type = var.organization.billing_type | ||
runtime_type = var.organization.runtime_type | ||
runtime_database_encryption_key_name = var.organization.database_encryption_key | ||
retention = var.organization.retention | ||
disable_vpc_peering = var.organization.disable_vpc_peering | ||
} | ||
|
||
resource "google_apigee_envgroup" "envgroups" { | ||
|
@@ -91,7 +92,7 @@ resource "google_apigee_instance" "instances" { | |
description = each.value.description | ||
location = each.key | ||
org_id = local.org_id | ||
ip_range = "${each.value.runtime_ip_cidr_range},${each.value.troubleshooting_ip_cidr_range}" | ||
ip_range = var.organization.disable_vpc_peering ? null : "${each.value.runtime_ip_cidr_range},${each.value.troubleshooting_ip_cidr_range}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before, I'd add a validation to variable (or maybe here you need a precondition check since it's s different variable) |
||
disk_encryption_key_name = each.value.disk_encryption_key | ||
consumer_accept_list = each.value.consumer_accept_list | ||
} | ||
|
@@ -117,6 +118,9 @@ resource "google_apigee_instance_attachment" "instance_attachments" { | |
instance_id = google_apigee_instance.instances[each.value.region].id | ||
environment = try(google_apigee_environment.environments[each.value.environment].name, | ||
"${local.org_id}/environments/${each.value.environment}") | ||
lifecycle { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an issue which is occurring because
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had some doubts about this too:
But in the end it will work as expected, because if you change the environment name, you change the key in the resource, thus forcing replacement. I'd love to have a comment here in the code about one and the other (so save my future-self from thinking this over again) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The And on another note, |
||
ignore_changes = [environment] | ||
} | ||
} | ||
|
||
resource "google_apigee_endpoint_attachment" "endpoint_attachments" { | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
project_id = "my-project" | ||
organization = { | ||
display_name = "My Organization" | ||
description = "My Organization" | ||
# authorized_network = "my-vpc" | ||
runtime_type = "CLOUD" | ||
billing_type = "Pay-as-you-go" | ||
database_encryption_key = "123456789" | ||
analytics_region = "europe-west1" | ||
disable_vpc_peering = true | ||
} | ||
instances = { | ||
europe-west1 = { | ||
# runtime_ip_cidr_range = "10.0.4.0/22" | ||
# troubleshooting_ip_cidr_range = "10.1.1.0/28" | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
values: | ||
google_apigee_instance.instances["europe-west1"]: | ||
description: Terraform-managed | ||
disk_encryption_key_name: null | ||
display_name: null | ||
# ip_range: 10.0.4.0/22,10.1.1.0/28 | ||
location: europe-west1 | ||
name: instance-europe-west1 | ||
google_apigee_organization.organization[0]: | ||
analytics_region: europe-west1 | ||
# authorized_network: my-vpc | ||
billing_type: Pay-as-you-go | ||
description: null | ||
display_name: null | ||
project_id: my-project | ||
retention: DELETION_RETENTION_UNSPECIFIED | ||
runtime_database_encryption_key_name: '123456789' | ||
runtime_type: CLOUD | ||
disable_vpc_peering: true | ||
|
||
counts: | ||
google_apigee_instance: 1 | ||
google_apigee_organization: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
project_id = "my-project" | ||
organization = { | ||
display_name = "My Organization" | ||
description = "My Organization" | ||
authorized_network = "my-vpc" | ||
runtime_type = "CLOUD" | ||
billing_type = "Pay-as-you-go" | ||
database_encryption_key = "123456789" | ||
analytics_region = "europe-west1" | ||
disable_vpc_peering = false | ||
} | ||
instances = { | ||
europe-west1 = { | ||
runtime_ip_cidr_range = "10.0.4.0/22" | ||
troubleshooting_ip_cidr_range = "10.1.1.0/28" | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
values: | ||
google_apigee_instance.instances["europe-west1"]: | ||
description: Terraform-managed | ||
disk_encryption_key_name: null | ||
display_name: null | ||
ip_range: 10.0.4.0/22,10.1.1.0/28 | ||
location: europe-west1 | ||
name: instance-europe-west1 | ||
google_apigee_organization.organization[0]: | ||
analytics_region: europe-west1 | ||
authorized_network: my-vpc | ||
billing_type: Pay-as-you-go | ||
description: null | ||
display_name: null | ||
project_id: my-project | ||
retention: DELETION_RETENTION_UNSPECIFIED | ||
runtime_database_encryption_key_name: '123456789' | ||
runtime_type: CLOUD | ||
disable_vpc_peering: false | ||
|
||
counts: | ||
google_apigee_instance: 1 | ||
google_apigee_organization: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
project_id = "my-project" | ||
organization = { | ||
display_name = "My Organization" | ||
description = "My Organization" | ||
authorized_network = null | ||
runtime_type = "CLOUD" | ||
billing_type = "PAYG" | ||
database_encryption_key = "123456789" | ||
analytics_region = "europe-west1" | ||
disable_vpc_peering = true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,9 @@ tests: | |
env_only_with_api_proxy_type: | ||
env_only_with_deployment_type: | ||
envgroup_only: | ||
instance_only: | ||
instance_only_psc_mode: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add this additional tests as examples in the readme? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||
instance_only_vpc_mode: | ||
no_instances: | ||
organization_only: | ||
organization_only_psc_mode: | ||
organization_only_vpc_mode: | ||
organization_retention: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add more examples and keep this one as it was?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.