googleApiGatewayApiConfig
An API Configuration is an association of an API Controller Config and a Gateway Config
\~> Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
To get more information about ApiConfig, see:
- API documentation
- How-to Guides
- Official Documentation
Example Usage - Apigateway Api Config Basic
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleApiGatewayApiApiCfg = new google.apiGatewayApi.ApiGatewayApi(
this,
"api_cfg",
{
api_id: "my-api",
provider: "${google-beta}",
}
);
const googleApiGatewayApiConfigApiCfg =
new google.apiGatewayApiConfig.ApiGatewayApiConfig(this, "api_cfg_1", {
api: googleApiGatewayApiApiCfg.apiId,
api_config_id: "my-config",
openapi_documents: [
{
document: [
{
contents: '${filebase64("test-fixtures/apigateway/openapi.yaml")}',
path: "spec.yaml",
},
],
},
],
provider: "${google-beta}",
});
googleApiGatewayApiConfigApiCfg.addOverride("lifecycle", [
{
create_before_destroy: true,
},
]);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleApiGatewayApiConfigApiCfg.overrideLogicalId("api_cfg");
Example Usage - Apigateway Api Config Grpc
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleApiGatewayApiApiCfg = new google.apiGatewayApi.ApiGatewayApi(
this,
"api_cfg",
{
api_id: "my-api",
provider: "${google-beta}",
}
);
const googleApiGatewayApiConfigApiCfg =
new google.apiGatewayApiConfig.ApiGatewayApiConfig(this, "api_cfg_1", {
api: googleApiGatewayApiApiCfg.apiId,
api_config_id: "my-config",
grpc_services: [
{
file_descriptor_set: [
{
contents:
'${filebase64("test-fixtures/apigateway/api_descriptor.pb")}',
path: "api_descriptor.pb",
},
],
},
],
managed_service_configs: [
{
contents: `\${base64encode(<<-EOF
type: google.api.Service
config_version: 3
name: \${${googleApiGatewayApiApiCfg.managedService}}
title: gRPC API example
apis:
- name: endpoints.examples.bookstore.Bookstore
usage:
rules:
- selector: endpoints.examples.bookstore.Bookstore.ListShelves
allow_unregistered_calls: true
backend:
rules:
- selector: "*"
address: grpcs://example.com
disable_auth: true
EOF
)}`,
path: "api_config.yaml",
},
],
provider: "${google-beta}",
});
googleApiGatewayApiConfigApiCfg.addOverride("lifecycle", [
{
create_before_destroy: true,
},
]);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleApiGatewayApiConfigApiCfg.overrideLogicalId("api_cfg");
Argument Reference
The following arguments are supported:
api
- (Required) The API to attach the config to.
-
displayName
- (Optional) A user-visible name for the API. -
labels
- (Optional) Resource labels to represent user-provided metadata. -
gatewayConfig
- (Optional) Immutable. Gateway specific configuration. If not specified, backend authentication will be set to use OIDC authentication using the default compute service account Structure is documented below. -
openapiDocuments
- (Optional) OpenAPI specification documents. If specified, grpcServices and managedServiceConfigs must not be included. Structure is documented below. -
grpcServices
- (Optional) gRPC service definition files. If specified, openapiDocuments must not be included. Structure is documented below. -
managedServiceConfigs
- (Optional) Optional. Service Configuration files. At least one must be included when using gRPC service definitions. See https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#service_configuration_overview for the expected file contents. If multiple files are specified, the files are merged with the following rules: * All singular scalar fields are merged using "last one wins" semantics in the order of the files uploaded. * Repeated fields are concatenated. * Singular embedded messages are merged using these rules for nested fields. Structure is documented below. -
apiConfigId
- (Optional) Identifier to assign to the API Config. Must be unique within scope of the parent resource(api). -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. -
apiConfigIdPrefix
- (Optional) Creates a unique name beginning with the specified prefix. If this and api_config_id are unspecified, a random value is chosen for the name.
The gatewayConfig
block supports:
backendConfig
- (Required) Backend settings that are applied to all backends of the Gateway. Structure is documented below.
The backendConfig
block supports:
googleServiceAccount
- (Required) Google Cloud IAM service account used to sign OIDC tokens for backends that have authentication configured (https://cloud.google.com/service-infrastructure/docs/service-management/reference/rest/v1/services.configs#backend).
The openapiDocuments
block supports:
document
- (Required) The OpenAPI Specification document file. Structure is documented below.
-
path
- (Required) The file path (full or relative path). This is typically the path of the file when it is uploaded. -
contents
- (Required) Base64 encoded content of the file.
The grpcServices
block supports:
-
fileDescriptorSet
- (Required) Input only. File descriptor set, generated by protoc. To generate, use protoc with imports and source info included. For an example test.proto file, the following command would put the value in a new file named out.pb. $ protoc --include_imports --include_source_info test.proto -o out.pb Structure is documented below. -
source
- (Optional) Uncompiled proto files associated with the descriptor set, used for display purposes (server-side compilation is not supported). These should match the inputs to 'protoc' command used to generate fileDescriptorSet. Structure is documented below.
The fileDescriptorSet
block supports:
-
path
- (Required) The file path (full or relative path). This is typically the path of the file when it is uploaded. -
contents
- (Required) Base64 encoded content of the file.
-
path
- (Required) The file path (full or relative path). This is typically the path of the file when it is uploaded. -
contents
- (Required) Base64 encoded content of the file.
The managedServiceConfigs
block supports:
-
path
- (Required) The file path (full or relative path). This is typically the path of the file when it is uploaded. -
contents
- (Required) Base64 encoded content of the file.
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
-
id
- an identifier for the resource with formatprojects/{{project}}/locations/global/apis/{{api}}/configs/{{apiConfigId}}
-
name
- The resource name of the API Config. -
serviceConfigId
- The ID of the associated Service Config (https://cloud.google.com/service-infrastructure/docs/glossary#config).
Timeouts
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.
Import
ApiConfig can be imported using any of these accepted formats:
$ terraform import google_api_gateway_api_config.default projects/{{project}}/locations/global/apis/{{api}}/configs/{{api_config_id}}
$ terraform import google_api_gateway_api_config.default {{project}}/{{api}}/{{api_config_id}}
$ terraform import google_api_gateway_api_config.default {{api}}/{{api_config_id}}
User Project Overrides
This resource supports User Project Overrides.