2022-10-24 08:44:21 -07:00
# Apigee
2022-11-28 00:55:51 -08:00
This module simplifies the creation of a Apigee resources (organization, environment groups, environment group attachments, environments, instances and instance attachments).
2022-10-24 08:44:21 -07:00
## Example
### All resources (CLOUD)
```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
organization = {
display_name = "My Organization"
description = "My Organization"
authorized_network = "my-vpc"
runtime_type = "CLOUD"
billing_type = "PAYG"
database_encryption_key = "123456789"
analytics_region = "europe-west1"
}
envgroups = {
test = ["test.example.com"]
prod = ["prod.example.com"]
}
environments = {
apis-test = {
2023-01-27 06:37:57 -08:00
display_name = "APIs test"
description = "APIs Test"
deployment_type = "ARCHIVE"
api_proxy_type = "PROGRAMMABLE"
envgroups = ["test"]
2022-10-24 08:44:21 -07:00
}
apis-prod = {
2023-01-27 06:37:57 -08:00
display_name = "APIs prod"
description = "APIs prod"
deployment_type = "PROXY"
api_proxy_type = "CONFIGURABLE"
envgroups = ["prod"]
2022-10-24 08:44:21 -07:00
iam = {
"roles/viewer" = ["group:devops@myorg.com"]
}
}
}
instances = {
instance-test-ew1 = {
2023-01-24 07:57:01 -08:00
region = "europe-west1"
environments = ["apis-test"]
runtime_ip_cidr_range = "10.0.4.0/22"
troubleshooting_ip_cidr_range = "10.1.1.0.0/28"
2022-10-24 08:44:21 -07:00
}
2022-11-28 00:55:51 -08:00
instance-prod-ew3 = {
2023-01-24 07:57:01 -08:00
region = "europe-west3"
environments = ["apis-prod"]
runtime_ip_cidr_range = "10.0.8.0/22"
troubleshooting_ip_cidr_range = "10.1.16.0/28"
2022-10-24 08:44:21 -07:00
}
}
2022-11-22 03:51:27 -08:00
endpoint_attachments = {
endpoint-backend-1 = {
region = "europe-west1"
service_attachment = "projects/my-project-1/serviceAttachments/gkebackend1"
}
endpoint-backend-2 = {
region = "europe-west1"
service_attachment = "projects/my-project-2/serviceAttachments/gkebackend2"
}
}
2022-10-24 08:44:21 -07:00
}
2022-11-22 03:51:27 -08:00
# tftest modules=1 resources=14
2022-10-24 08:44:21 -07:00
```
### All resources (HYBRID control plane)
```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
organization = {
2022-12-16 03:53:56 -08:00
display_name = "My Organization"
description = "My Organization"
runtime_type = "HYBRID"
analytics_region = "europe-west1"
2022-10-24 08:44:21 -07:00
}
envgroups = {
test = ["test.example.com"]
prod = ["prod.example.com"]
}
environments = {
apis-test = {
2022-12-16 03:53:56 -08:00
display_name = "APIs test"
description = "APIs Test"
envgroups = ["test"]
2022-10-24 08:44:21 -07:00
}
apis-prod = {
2022-12-16 03:53:56 -08:00
display_name = "APIs prod"
description = "APIs prod"
envgroups = ["prod"]
2022-10-24 08:44:21 -07:00
iam = {
"roles/viewer" = ["group:devops@myorg.com"]
}
}
}
}
# tftest modules=1 resources=8
```
### New environment group in an existing organization
```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
envgroups = {
test = ["test.example.com"]
}
}
# tftest modules=1 resources=1
```
### New environment in an existing environment group
```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
environments = {
apis-test = {
2022-12-16 03:53:56 -08:00
display_name = "APIs test"
description = "APIs Test"
envgroups = ["test"]
2022-10-24 08:44:21 -07:00
}
}
}
# tftest modules=1 resources=2
```
### New instance attached to an existing environment
```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
instances = {
instance-test-ew1 = {
2023-01-24 07:57:01 -08:00
region = "europe-west1"
environments = ["apis-test"]
runtime_ip_cidr_range = "10.0.4.0/22"
troubleshooting_ip_cidr_range = "10.1.1.0/28"
2022-10-24 08:44:21 -07:00
}
}
}
# tftest modules=1 resources=2
```
2022-11-22 03:51:27 -08:00
### New endpoint attachment
Endpoint attachments allow to implement [Apigee southbound network patterns ](https://cloud.google.com/apigee/docs/api-platform/architecture/southbound-networking-patterns-endpoints#create-the-psc-attachments ).
```hcl
module "apigee" {
source = "./fabric/modules/apigee"
project_id = "my-project"
endpoint_attachments = {
endpoint-backend-1 = {
region = "europe-west1"
service_attachment = "projects/my-project-1/serviceAttachments/gkebackend1"
}
}
}
# tftest modules=1 resources=1
```
2022-10-24 08:44:21 -07:00
<!-- BEGIN TFDOC -->
## Variables
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
2023-01-24 07:57:01 -08:00
| [project_id ](variables.tf#L78 ) | Project ID. | < code > string</ code > | ✓ | |
2022-11-22 03:51:27 -08:00
| [endpoint_attachments ](variables.tf#L17 ) | Endpoint attachments. | < code title = "map(object({ region = string service_attachment = string }))" > map( object({…})) </ code > | | < code > null</ code > |
| [envgroups ](variables.tf#L26 ) | Environment groups (NAME => [HOSTNAMES]). | < code > map( list( string)) </ code > | | < code > null</ code > |
2023-01-27 06:37:57 -08:00
| [environments ](variables.tf#L32 ) | Environments. | < code title = "map(object({ display_name = optional(string) description = optional(string, "Terraform-managed") deployment_type = optional(string) api_proxy_type = optional(string) node_config = optional(object({ min_node_count = optional(number) max_node_count = optional(number) })) iam = optional(map(list(string))) envgroups = list(string) }))" > map( object({…})) </ code > | | < code > null</ code > |
2023-01-24 07:57:01 -08:00
| [instances ](variables.tf#L49 ) | Instances. | < code title = "map(object({ display_name = optional(string) description = optional(string, "Terraform-managed") region = string environments = list(string) runtime_ip_cidr_range = string troubleshooting_ip_cidr_range = string disk_encryption_key = optional(string) consumer_accept_list = optional(list(string)) }))" > map( object({…})) </ code > | | < code > null</ code > |
| [organization ](variables.tf#L64 ) | Apigee organization. If set to null the organization must already exist. | < code title = "object({ display_name = optional(string) description = optional(string, "Terraform-managed") authorized_network = optional(string) runtime_type = optional(string, "CLOUD") billing_type = optional(string) database_encryption_key = optional(string) analytics_region = optional(string, "europe-west1") })" > object({…}) </ code > | | < code > null</ code > |
2022-10-24 08:44:21 -07:00
## Outputs
| name | description | sensitive |
|---|---|:---:|
2022-12-22 06:30:24 -08:00
| [endpoint_attachment_hosts ](outputs.tf#L17 ) | Endpoint hosts. | |
| [envgroups ](outputs.tf#L22 ) | Environment groups. | |
| [environments ](outputs.tf#L27 ) | Environment. | |
| [instances ](outputs.tf#L32 ) | Instances. | |
| [org_id ](outputs.tf#L37 ) | Organization ID. | |
| [org_name ](outputs.tf#L42 ) | Organization name. | |
| [organization ](outputs.tf#L47 ) | Organization. | |
| [service_attachments ](outputs.tf#L52 ) | Service attachments. | |
2022-10-24 08:44:21 -07:00
<!-- END TFDOC -->