github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/api_gateway_usage_plan.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_api_gateway_usage_plan"
     4  sidebar_current: "docs-aws-resource-api-gateway-usage-plan"
     5  description: |-
     6    Provides an API Gateway Usage Plan.
     7  ---
     8  
     9  # aws_api_gateway_usage_plan
    10  
    11  Provides an API Gateway Usage Plan.
    12  
    13  ## Example Usage
    14  
    15  ```hcl
    16  resource "aws_api_gateway_rest_api" "myapi" {
    17    name = "MyDemoAPI"
    18  }
    19  
    20  ...
    21  
    22  resource "aws_api_gateway_deployment" "dev" {
    23    rest_api_id = "${aws_api_gateway_rest_api.myapi.id}"
    24    stage_name = "dev"
    25  }
    26  
    27  resource "aws_api_gateway_deployment" "prod" {
    28    rest_api_id = "${aws_api_gateway_rest_api.myapi.id}"
    29    stage_name = "prod"
    30  }
    31  
    32  resource "aws_api_gateway_usage_plan" "MyUsagePlan" {
    33    name         = "my-usage-plan"
    34    description  = "my description"
    35    product_code = "MYCODE"
    36  
    37    api_stages {
    38      api_id = "${aws_api_gateway_rest_api.myapi.id}"
    39      stage  = "${aws_api_gateway_deployment.dev.stage_name}"
    40    }
    41  
    42    api_stages {
    43      api_id = "${aws_api_gateway_rest_api.myapi.id}"
    44      stage  = "${aws_api_gateway_deployment.prod.stage_name}"
    45    }
    46  
    47    quota_settings {
    48      limit  = 20
    49      offset = 2
    50      period = "WEEK"
    51    }
    52  
    53    throttle_settings {
    54      burst_limit = 5
    55      rate_limit  = 10
    56    }
    57  }
    58  ```
    59  
    60  ## Argument Reference
    61  
    62  The API Gateway Usage Plan argument layout is a structure composed of several sub-resources - these resources are laid out below.
    63  
    64  ### Top-Level Arguments
    65  
    66  * `name` - (Required) The name of the usage plan.
    67  * `description` - (Required) The description of a usage plan.
    68  * `api_stages` - (Optional) The associated [API stages](#api-stages-arguments) of the usage plan.
    69  * `quota_settings` - (Optional) The [quota settings](#quota-settings-arguments) of the usage plan.
    70  * `throttle_settings` - (Optional) The [throttling limits](#throttling-settings-arguments) of the usage plan.
    71  * `product_code` - (Optional) The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
    72  
    73  #### Api Stages arguments
    74  
    75    * `api_id` (Required) - API Id of the associated API stage in a usage plan.
    76    * `stage` (Required) - API stage name of the associated API stage in a usage plan.
    77  
    78  #### Quota Settings Arguments
    79  
    80    * `limit` (Optional) - The maximum number of requests that can be made in a given time period.
    81    * `offset` (Optional) - The number of requests subtracted from the given limit in the initial time period.
    82    * `period` (Optional) - The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
    83  
    84  #### Throttling Settings Arguments
    85  
    86    * `burst_limit` (Optional) - The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
    87    * `rate_limit` (Optional) - The API request steady-state rate limit.
    88  
    89  ## Attributes Reference
    90  
    91  The following attributes are exported:
    92  
    93  * `id` - The ID of the API resource
    94  * `name` - The name of the usage plan.
    95  * `description` - The description of a usage plan.
    96  * `api_stages` - The associated API stages of the usage plan.
    97  * `quota_settings` - The quota of the usage plan.
    98  * `throttle_settings` - The throttling limits of the usage plan.
    99  * `product_code` - The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
   100  
   101  ## Import
   102  
   103  AWS API Gateway Usage Plan can be imported using the `id`, e.g.
   104  
   105  ```
   106  $ terraform import aws_api_gateway_usage_plan.myusageplan <usage_plan_id>
   107  ```