6941313c7d
* factories refactor doc * Adds file schema and filesystem organization * Update 20231106-factories.md * move factories out of blueprints and create new factories README * align factory in billing-account module * align factory in dataplex-datascan module * align factory in billing-account module * align factory in net-firewall-policy module * align factory in dns-response-policy module * align factory in net-vpc-firewall module * align factory in net-vpc module * align factory variable names in FAST * remove decentralized firewall blueprint * bump terraform version * bump module versions * update top-level READMEs * move project factory to modules * fix variable names and tests * tfdoc * remove changelog link * add project factory to top-level README * fix cludrun eventarc diff * fix README * fix cludrun eventarc diff --------- Co-authored-by: Simone Ruffilli <sruffilli@google.com> |
||
---|---|---|
.. | ||
README.md | ||
main.tf | ||
outputs.tf | ||
variables.tf | ||
versions.tf |
README.md
API Gateway
This module allows creating an API with its associated API config and API gateway. It also allows you grant IAM roles on the created resources.
Examples
Basic example
module "gateway" {
source = "./fabric/modules/api-gateway"
project_id = "my-project"
api_id = "api"
region = "europe-west1"
spec = <<EOT
# The OpenAPI spec contents
# ...
EOT
}
# tftest modules=1 resources=4 inventory=basic.yaml
Use existing service account
module "gateway" {
source = "./fabric/modules/api-gateway"
project_id = "my-project"
api_id = "api"
region = "europe-west1"
service_account_email = "sa@my-project.iam.gserviceaccount.com"
iam = {
"roles/apigateway.admin" = ["user:user@example.com"]
}
spec = <<EOT
# The OpenAPI spec contents
# ...
EOT
}
# tftest modules=1 resources=7 inventory=existing-sa.yaml
Create service account
module "gateway" {
source = "./fabric/modules/api-gateway"
project_id = "my-project"
api_id = "api"
region = "europe-west1"
service_account_create = true
iam = {
"roles/apigateway.admin" = ["user:mirene@google.com"]
"roles/apigateway.viewer" = ["user:mirene@google.com"]
}
spec = <<EOT
# The OpenAPI spec contents
# ...
EOT
}
# tftest modules=1 resources=11 inventory=create-sa.yaml
Variables
name | description | type | required | default |
---|---|---|---|---|
api_id | API identifier. | string |
✓ | |
project_id | Project identifier. | string |
✓ | |
region | Region. | string |
✓ | |
spec | String with the contents of the OpenAPI spec. | string |
✓ | |
iam | IAM bindings for the API in {ROLE => [MEMBERS]} format. | map(list(string)) |
null |
|
labels | Map of labels. | map(string) |
null |
|
service_account_create | Flag indicating whether a service account needs to be created. | bool |
false |
|
service_account_email | Service account for creating API configs. | string |
null |
Outputs
name | description | sensitive |
---|---|---|
api | API. | |
api_config | API configs. | |
api_config_id | The identifiers of the API configs. | |
api_id | API identifier. | |
default_hostname | The default host names of the API gateway. | |
gateway | API gateways. | |
gateway_id | The identifiers of the API gateways. | |
service_account | Service account resource. | |
service_account_email | The service account for creating API configs. | |
service_account_iam_email | The service account for creating API configs. |