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

Apigee addons #1580

Merged
merged 1 commit into from
Aug 9, 2023
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
2 changes: 1 addition & 1 deletion blueprints/apigee/bigquery-analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ module "test" {
europe-west1 = "10.0.0.0/28"
}
}
# tftest modules=10 resources=64
# tftest modules=10 resources=65
```
2 changes: 1 addition & 1 deletion blueprints/apigee/hybrid-gke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ module "test" {
project_id = "my-project"
hostname = "test.myorg.org"
}
# tftest modules=18 resources=61
# tftest modules=18 resources=62
```
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ module "test" {
onprem_project_id = "my-onprem-project"
hostname = "test.myorg.org"
}
# tftest modules=14 resources=77
# tftest modules=14 resources=78
```
36 changes: 25 additions & 11 deletions modules/apigee/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module "apigee" {
}
}
}
# tftest modules=1 resources=14
# tftest modules=1 resources=15
```

### All resources (HYBRID control plane)
Expand Down Expand Up @@ -96,7 +96,7 @@ module "apigee" {
}
}
}
# tftest modules=1 resources=8
# tftest modules=1 resources=9
```

### New environment group
Expand All @@ -109,7 +109,7 @@ module "apigee" {
test = ["test.example.com"]
}
}
# tftest modules=1 resources=1
# tftest modules=1 resources=2
```

### New environment
Expand All @@ -125,7 +125,7 @@ module "apigee" {
}
}
}
# tftest modules=1 resources=1
# tftest modules=1 resources=2
```

### New instance
Expand All @@ -141,7 +141,7 @@ module "apigee" {
}
}
}
# tftest modules=1 resources=1
# tftest modules=1 resources=2
```

### New endpoint attachment
Expand All @@ -159,19 +159,33 @@ module "apigee" {
}
}
}
# tftest modules=1 resources=2
```

### Apigee add-ons

```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
addons_config = {
monetization = true
}
}
# tftest modules=1 resources=1
```
<!-- BEGIN TFDOC -->
## Variables

| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [project_id](variables.tf#L78) | Project ID. | <code>string</code> | ✓ | |
| [endpoint_attachments](variables.tf#L17) | Endpoint attachments. | <code title="map&#40;object&#40;&#123;&#10; region &#61; string&#10; service_attachment &#61; string&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>null</code> |
| [envgroups](variables.tf#L26) | Environment groups (NAME => [HOSTNAMES]). | <code>map&#40;list&#40;string&#41;&#41;</code> | | <code>null</code> |
| [environments](variables.tf#L32) | Environments. | <code title="map&#40;object&#40;&#123;&#10; display_name &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; deployment_type &#61; optional&#40;string&#41;&#10; api_proxy_type &#61; optional&#40;string&#41;&#10; node_config &#61; optional&#40;object&#40;&#123;&#10; min_node_count &#61; optional&#40;number&#41;&#10; max_node_count &#61; optional&#40;number&#41;&#10; &#125;&#41;&#41;&#10; iam &#61; optional&#40;map&#40;list&#40;string&#41;&#41;&#41;&#10; envgroups &#61; optional&#40;list&#40;string&#41;&#41;&#10; regions &#61; optional&#40;list&#40;string&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>null</code> |
| [instances](variables.tf#L50) | Instances ([REGION] => [INSTANCE]). | <code title="map&#40;object&#40;&#123;&#10; display_name &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; runtime_ip_cidr_range &#61; string&#10; troubleshooting_ip_cidr_range &#61; string&#10; disk_encryption_key &#61; optional&#40;string&#41;&#10; consumer_accept_list &#61; optional&#40;list&#40;string&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>null</code> |
| [organization](variables.tf#L63) | Apigee organization. If set to null the organization must already exist. | <code title="object&#40;&#123;&#10; display_name &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; authorized_network &#61; optional&#40;string&#41;&#10; runtime_type &#61; optional&#40;string, &#34;CLOUD&#34;&#41;&#10; billing_type &#61; optional&#40;string&#41;&#10; database_encryption_key &#61; optional&#40;string&#41;&#10; analytics_region &#61; optional&#40;string, &#34;europe-west1&#34;&#41;&#10; retention &#61; optional&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [project_id](variables.tf#L90) | Project ID. | <code>string</code> | ✓ | |
| [addons_config](variables.tf#L17) | Addons configuration. | <code title="object&#40;&#123;&#10; advanced_api_ops &#61; optional&#40;bool, false&#41;&#10; api_security &#61; optional&#40;bool, false&#41;&#10; connectors_platform &#61; optional&#40;bool, false&#41;&#10; integration &#61; optional&#40;bool, false&#41;&#10; monetization &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [endpoint_attachments](variables.tf#L29) | Endpoint attachments. | <code title="map&#40;object&#40;&#123;&#10; region &#61; string&#10; service_attachment &#61; string&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>null</code> |
| [envgroups](variables.tf#L38) | Environment groups (NAME => [HOSTNAMES]). | <code>map&#40;list&#40;string&#41;&#41;</code> | | <code>null</code> |
| [environments](variables.tf#L44) | Environments. | <code title="map&#40;object&#40;&#123;&#10; display_name &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; deployment_type &#61; optional&#40;string&#41;&#10; api_proxy_type &#61; optional&#40;string&#41;&#10; node_config &#61; optional&#40;object&#40;&#123;&#10; min_node_count &#61; optional&#40;number&#41;&#10; max_node_count &#61; optional&#40;number&#41;&#10; &#125;&#41;&#41;&#10; iam &#61; optional&#40;map&#40;list&#40;string&#41;&#41;&#41;&#10; envgroups &#61; optional&#40;list&#40;string&#41;&#41;&#10; regions &#61; optional&#40;list&#40;string&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>null</code> |
| [instances](variables.tf#L62) | Instances ([REGION] => [INSTANCE]). | <code title="map&#40;object&#40;&#123;&#10; display_name &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; runtime_ip_cidr_range &#61; string&#10; troubleshooting_ip_cidr_range &#61; string&#10; disk_encryption_key &#61; optional&#40;string&#41;&#10; consumer_accept_list &#61; optional&#40;list&#40;string&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>null</code> |
| [organization](variables.tf#L75) | Apigee organization. If set to null the organization must already exist. | <code title="object&#40;&#123;&#10; display_name &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; authorized_network &#61; optional&#40;string&#41;&#10; runtime_type &#61; optional&#40;string, &#34;CLOUD&#34;&#41;&#10; billing_type &#61; optional&#40;string&#41;&#10; database_encryption_key &#61; optional&#40;string&#41;&#10; analytics_region &#61; optional&#40;string, &#34;europe-west1&#34;&#41;&#10; retention &#61; optional&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |

## Outputs

Expand Down
40 changes: 40 additions & 0 deletions modules/apigee/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

locals {
org_id = try(google_apigee_organization.organization[0].id, "organizations/${var.project_id}")
org_name = try(google_apigee_organization.organization[0].name, var.project_id)
envgroups = coalesce(var.envgroups, {})
environments = coalesce(var.environments, {})
instances = coalesce(var.instances, {})
Expand Down Expand Up @@ -119,3 +120,42 @@ resource "google_apigee_endpoint_attachment" "endpoint_attachments" {
location = each.value.region
service_attachment = each.value.service_attachment
}

resource "google_apigee_addons_config" "test_organization" {
org = local.org_name
dynamic "addons_config" {
for_each = var.addons_config == null ? [] : [""]
content {
dynamic "advanced_api_ops_config" {
for_each = var.addons_config.advanced_api_ops ? [] : [""]
content {
enabled = true
}
}
dynamic "api_security_config" {
for_each = var.addons_config.api_security ? [] : [""]
content {
enabled = true
}
}
dynamic "connectors_platform_config" {
for_each = var.addons_config.connectors_platform ? [] : [""]
content {
enabled = true
}
}
dynamic "integration_config" {
for_each = var.addons_config.integration ? [] : [""]
content {
enabled = true
}
}
dynamic "monetization_config" {
for_each = var.addons_config.monetization ? [] : [""]
content {
enabled = true
}
}
}
}
}
12 changes: 12 additions & 0 deletions modules/apigee/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
* limitations under the License.
*/

variable "addons_config" {
description = "Addons configuration."
type = object({
advanced_api_ops = optional(bool, false)
api_security = optional(bool, false)
connectors_platform = optional(bool, false)
integration = optional(bool, false)
monetization = optional(bool, false)
})
default = null
}

variable "endpoint_attachments" {
description = "Endpoint attachments."
type = map(object({
Expand Down