A consumable API that can be used by multiple Gateways.
To get more information about Gateway, see:
resource "google_api_gateway_api" "api_gw" {
provider = google-beta
api_id = "my-api"
}
resource "google_api_gateway_api_config" "api_gw" {
provider = google-beta
api = google_api_gateway_api.api_gw.api_id
api_config_id = "my-config"
openapi_documents {
document {
path = "spec.yaml"
contents = filebase64("test-fixtures/openapi.yaml")
}
}
lifecycle {
create_before_destroy = true
}
}
resource "google_api_gateway_gateway" "api_gw" {
provider = google-beta
api_config = google_api_gateway_api_config.api_gw.id
gateway_id = "my-gateway"
}
The following arguments are supported:
api_config
-
(Required)
Resource name of the API Config for this Gateway. Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}.
When changing api configs please ensure the new config is a new resource and the
lifecycle rule create_before_destroy
is set.
gateway_id
-
(Required)
Identifier to assign to the Gateway. Must be unique within scope of the parent resource(project).
display_name
-
(Optional)
A user-visible name for the API.
labels
-
(Optional)
Resource labels to represent user-provided metadata.
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field effective_labels
for all of the labels present on the resource.
region
-
(Optional)
The region of the gateway for the API.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{region}}/gateways/{{gateway_id}}
name
-
Resource name of the Gateway. Format: projects/{project}/locations/{region}/gateways/{gateway}
default_hostname
-
The default API Gateway host name of the form {gatewayId}-{hash}.{region_code}.gateway.dev.
terraform_labels
-
The combination of labels configured directly on the resource
and default labels configured on the provider.
effective_labels
-
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.Gateway can be imported using any of these accepted formats:
projects/{{project}}/locations/{{region}}/gateways/{{gateway_id}}
{{project}}/{{region}}/{{gateway_id}}
{{region}}/{{gateway_id}}
{{gateway_id}}
In Terraform v1.5.0 and later, use an import
block to import Gateway using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{region}}/gateways/{{gateway_id}}"
to = google_api_gateway_gateway.default
}
When using the terraform import
command, Gateway can be imported using one of the formats above. For example:
$ terraform import google_api_gateway_gateway.default projects/{{project}}/locations/{{region}}/gateways/{{gateway_id}}
$ terraform import google_api_gateway_gateway.default {{project}}/{{region}}/{{gateway_id}}
$ terraform import google_api_gateway_gateway.default {{region}}/{{gateway_id}}
$ terraform import google_api_gateway_gateway.default {{gateway_id}}
This resource supports User Project Overrides.