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

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_api_gateway_deployment"
     4  sidebar_current: "docs-aws-resource-api-gateway-deployment"
     5  description: |-
     6    Provides an API Gateway Deployment.
     7  ---
     8  
     9  # aws\_api\_gateway\_deployment
    10  
    11  Provides an API Gateway Deployment.
    12  
    13  -> **Note:** Depends on having `aws_api_gateway_integration` inside your rest api (which in turn depends on `aws_api_gateway_method`). To avoid race conditions
    14  you might need to add an explicit `depends_on = ["aws_api_gateway_integration.name"]`.
    15  
    16  ## Example Usage
    17  
    18  ```hcl
    19  resource "aws_api_gateway_rest_api" "MyDemoAPI" {
    20    name        = "MyDemoAPI"
    21    description = "This is my API for demonstration purposes"
    22  }
    23  
    24  resource "aws_api_gateway_resource" "MyDemoResource" {
    25    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    26    parent_id   = "${aws_api_gateway_rest_api.MyDemoAPI.root_resource_id}"
    27    path_part   = "test"
    28  }
    29  
    30  resource "aws_api_gateway_method" "MyDemoMethod" {
    31    rest_api_id   = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    32    resource_id   = "${aws_api_gateway_resource.MyDemoResource.id}"
    33    http_method   = "GET"
    34    authorization = "NONE"
    35  }
    36  
    37  resource "aws_api_gateway_integration" "MyDemoIntegration" {
    38    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    39    resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
    40    http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
    41    type        = "MOCK"
    42  }
    43  
    44  resource "aws_api_gateway_deployment" "MyDemoDeployment" {
    45    depends_on = ["aws_api_gateway_method.MyDemoMethod"]
    46  
    47    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    48    stage_name  = "test"
    49  
    50    variables = {
    51      "answer" = "42"
    52    }
    53  }
    54  ```
    55  
    56  ## Argument Reference
    57  
    58  The following arguments are supported:
    59  
    60  * `rest_api_id` - (Required) The ID of the associated REST API
    61  * `stage_name` - (Required) The name of the stage
    62  * `description` - (Optional) The description of the deployment
    63  * `stage_description` - (Optional) The description of the stage
    64  * `variables` - (Optional) A map that defines variables for the stage
    65  
    66  ## Attribute Reference
    67  
    68  The following attributes are exported:
    69  
    70  * `id` - The ID of the deployment
    71  * `invoke_url` - The URL to invoke the API pointing to the stage,
    72    e.g. `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod`
    73  * `execution_arn` - The execution ARN to be used in [`lambda_permission`](/docs/providers/aws/r/lambda_permission.html)'s `source_arn`
    74    when allowing API Gateway to invoke a Lambda function,
    75    e.g. `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod`
    76  * `created_date` - The creation date of the deployment