Skip to content

googleApiGatewayGateway

A consumable API that can be used by multiple Gateways.

\~> 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 Gateway, see:

Example Usage - Apigateway Gateway 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 googleApiGatewayApiApiGw = new google.apiGatewayApi.ApiGatewayApi(
  this,
  "api_gw",
  {
    api_id: "my-api",
    provider: "${google-beta}",
  }
);
const googleApiGatewayApiConfigApiGw =
  new google.apiGatewayApiConfig.ApiGatewayApiConfig(this, "api_gw_1", {
    api: googleApiGatewayApiApiGw.apiId,
    api_config_id: "my-config",
    openapi_documents: [
      {
        document: [
          {
            contents: '${filebase64("test-fixtures/apigateway/openapi.yaml")}',
            path: "spec.yaml",
          },
        ],
      },
    ],
    provider: "${google-beta}",
  });
googleApiGatewayApiConfigApiGw.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.*/
googleApiGatewayApiConfigApiGw.overrideLogicalId("api_gw");
const googleApiGatewayGatewayApiGw =
  new google.apiGatewayGateway.ApiGatewayGateway(this, "api_gw_2", {
    api_config: googleApiGatewayApiConfigApiGw.id,
    gateway_id: "my-gateway",
    provider: "${google-beta}",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleApiGatewayGatewayApiGw.overrideLogicalId("api_gw");

Argument Reference

The following arguments are supported:

  • apiConfig - (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 createBeforeDestroy is set.

  • gatewayId - (Required) Identifier to assign to the Gateway. Must be unique within scope of the parent resource(project).


  • displayName - (Optional) A user-visible name for the API.

  • labels - (Optional) Resource labels to represent user-provided metadata.

  • 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.

Attributes Reference

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/{{gatewayId}}

  • name - Resource name of the Gateway. Format: projects/{project}/locations/{region}/gateways/{gateway}

  • defaultHostname - The default API Gateway host name of the form {gatewayId}-{hash}.{region_code}.gateway.dev.

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

Gateway can be imported using any of these accepted formats:

$ 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}}

User Project Overrides

This resource supports User Project Overrides.