Resource: aws_api_gateway_usage_plan_key

Provides an API Gateway Usage Plan Key.

Example Usage

resource "aws_api_gateway_rest_api" "test" {
  name = "MyDemoAPI"
}

# ...

resource "aws_api_gateway_usage_plan" "myusageplan" {
  name = "my_usage_plan"

  api_stages {
    api_id = aws_api_gateway_rest_api.test.id
    stage  = aws_api_gateway_stage.foo.stage_name
  }
}

resource "aws_api_gateway_api_key" "mykey" {
  name = "my_key"
}

resource "aws_api_gateway_usage_plan_key" "main" {
  key_id        = aws_api_gateway_api_key.mykey.id
  key_type      = "API_KEY"
  usage_plan_id = aws_api_gateway_usage_plan.myusageplan.id
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import AWS API Gateway Usage Plan Key using the USAGE-PLAN-ID/USAGE-PLAN-KEY-ID. For example:

import {
  to = aws_api_gateway_usage_plan_key.key
  id = "12345abcde/zzz"
}

Using terraform import, import AWS API Gateway Usage Plan Key using the USAGE-PLAN-ID/USAGE-PLAN-KEY-ID. For example:

% terraform import aws_api_gateway_usage_plan_key.key 12345abcde/zzz