Skip to content
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 consumer_accept_list to apigee-x-instance #704

Merged
merged 2 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- add `id` output to service account module
- add support for secrets to cloud function module
- new binary authorization module
- add `consumer_accept_list` option to `apigee-x-instance` module.

**FAST**

Expand Down
9 changes: 5 additions & 4 deletions modules/apigee-x-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ module "apigee-x-instance" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [apigee_org_id](variables.tf#L32) | Apigee Organization ID. | <code>string</code> | ✓ | |
| [name](variables.tf#L49) | Apigee instance name. | <code>string</code> | ✓ | |
| [region](variables.tf#L54) | Compute region. | <code>string</code> | ✓ | |
| [name](variables.tf#L55) | Apigee instance name. | <code>string</code> | ✓ | |
| [region](variables.tf#L60) | Compute region. | <code>string</code> | ✓ | |
| [apigee_envgroups](variables.tf#L17) | Apigee Environment Groups. | <code title="map&#40;object&#40;&#123;&#10; environments &#61; list&#40;string&#41;&#10; hostnames &#61; list&#40;string&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [apigee_environments](variables.tf#L26) | Apigee Environment Names. | <code>list&#40;string&#41;</code> | | <code>&#91;&#93;</code> |
| [disk_encryption_key](variables.tf#L43) | Customer Managed Encryption Key (CMEK) self link (e.g. `projects/foo/locations/us/keyRings/bar/cryptoKeys/baz`) used for disk and volume encryption (required for PAID Apigee Orgs only). | <code>string</code> | | <code>null</code> |
| [ip_range](variables.tf#L37) | Customer-provided CIDR blocks of length 22 and 28 for the Apigee instance (e.g. `10.0.0.0/22,10.1.0.0/28`). | <code>string</code> | | <code>null</code> |
| [consumer_accept_list](variables.tf#L37) | List of projects (id/number) that can privately connect to the service attachment. | <code>list&#40;string&#41;</code> | | <code>null</code> |
| [disk_encryption_key](variables.tf#L49) | Customer Managed Encryption Key (CMEK) self link (e.g. `projects/foo/locations/us/keyRings/bar/cryptoKeys/baz`) used for disk and volume encryption (required for PAID Apigee Orgs only). | <code>string</code> | | <code>null</code> |
| [ip_range](variables.tf#L43) | Customer-provided CIDR blocks of length 22 and 28 for the Apigee instance (e.g. `10.0.0.0/22,10.1.0.0/28`). | <code>string</code> | | <code>null</code> |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions modules/apigee-x-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ resource "google_apigee_instance" "apigee_instance" {
location = var.region
ip_range = var.ip_range
disk_encryption_key_name = var.disk_encryption_key
consumer_accept_list = var.consumer_accept_list
}

resource "google_apigee_instance_attachment" "apigee_instance_attchment" {
Expand Down
6 changes: 6 additions & 0 deletions modules/apigee-x-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ variable "apigee_org_id" {
type = string
}

variable "consumer_accept_list" {
description = "List of projects (id/number) that can privately connect to the service attachment."
type = list(string)
default = null
}

variable "ip_range" {
description = "Customer-provided CIDR blocks of length 22 and 28 for the Apigee instance (e.g. `10.0.0.0/22,10.1.0.0/28`)."
type = string
Expand Down
4 changes: 4 additions & 0 deletions tests/modules/apigee_x_instance/fixture/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ module "apigee-x-instance" {
"eval1",
"eval2"
]
consumer_accept_list = [
"project1",
"project2"
]
}
19 changes: 15 additions & 4 deletions tests/modules/apigee_x_instance/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,28 @@ def test_resource_count(resources):

def test_instance_attachment(resources):
"Test Apigee Instance Attachments."
attachments = [r['values'] for r in resources if r['type']
== 'google_apigee_instance_attachment']
attachments = [
r['values']
for r in resources
if r['type'] == 'google_apigee_instance_attachment'
]
assert len(attachments) == 2
assert set(a['environment'] for a in attachments) == set(['eval1', 'eval2'])


def test_instance(resources):
"Test Instance."
instances = [r['values'] for r in resources if r['type']
== 'google_apigee_instance']
instances = [
r['values'] for r in resources if r['type'] == 'google_apigee_instance'
]
assert len(instances) == 1
assert instances[0]['ip_range'] == '10.0.0.0/22,10.1.0.0/28'
assert instances[0]['name'] == 'my-test-instance'
assert instances[0]['location'] == 'europe-west1'


def test_instance_consumer_accept_list(resources):
instances = [
r['values'] for r in resources if r['type'] == 'google_apigee_instance'
]
assert instances[0]['consumer_accept_list'] == ['project1', 'project2']