Skip to content

Resource: awsApiGatewayUsagePlanKey

Provides an API Gateway Usage Plan Key.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsApiGatewayApiKeyMykey = new aws.apiGatewayApiKey.ApiGatewayApiKey(
  this,
  "mykey",
  {
    name: "my_key",
  }
);
const awsApiGatewayRestApiTest = new aws.apiGatewayRestApi.ApiGatewayRestApi(
  this,
  "test",
  {
    name: "MyDemoAPI",
  }
);
const awsApiGatewayUsagePlanMyusageplan =
  new aws.apiGatewayUsagePlan.ApiGatewayUsagePlan(this, "myusageplan", {
    apiStages: [
      {
        apiId: awsApiGatewayRestApiTest.id,
        stage: "${aws_api_gateway_stage.foo.stage_name}",
      },
    ],
    name: "my_usage_plan",
  });
new aws.apiGatewayUsagePlanKey.ApiGatewayUsagePlanKey(this, "main", {
  keyId: awsApiGatewayApiKeyMykey.id,
  keyType: "API_KEY",
  usagePlanId: awsApiGatewayUsagePlanMyusageplan.id,
});

Argument Reference

The following arguments are supported:

  • keyId - (Required) Identifier of the API key resource.
  • keyType - (Required) Type of the API key resource. Currently, the valid key type is API_KEY.
  • usagePlanId - (Required) Id of the usage plan resource representing to associate the key to.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - ID of a usage plan key.
  • keyId - Identifier of the API gateway key resource.
  • keyType - Type of a usage plan key. Currently, the valid key type is API_KEY.
  • usagePlanId - ID of the API resource
  • name - Name of a usage plan key.
  • value - Value of a usage plan key.

Import

AWS API Gateway Usage Plan Key can be imported using the usagePlanId/usagePlanKeyId, e.g.,

$ terraform import aws_api_gateway_usage_plan_key.key 12345abcde/zzz