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.
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 = " [email protected] "
iam = {
" roles/apigateway.admin" = [" user:[email protected] " ]
}
spec = << EOT
# The OpenAPI spec contents
# ...
EOT
}
# tftest modules=1 resources=7 inventory=existing-sa.yaml
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:[email protected] " ]
" roles/apigateway.viewer" = [" user:[email protected] " ]
}
spec = << EOT
# The OpenAPI spec contents
# ...
EOT
}
# tftest modules=1 resources=11 inventory=create-sa.yaml
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