github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/r/api_gateway_method_settings.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_api_gateway_method_settings" 4 sidebar_current: "docs-aws-resource-api-gateway-method-settings" 5 description: |- 6 Provides an API Gateway Method Settings, e.g. logging or monitoring. 7 --- 8 9 # aws\_api\_gateway\_method\_settings 10 11 Provides an API Gateway Method Settings, e.g. logging or monitoring. 12 13 ## Example Usage 14 15 ```hcl 16 resource "aws_api_gateway_method_settings" "s" { 17 rest_api_id = "${aws_api_gateway_rest_api.test.id}" 18 stage_name = "${aws_api_gateway_stage.test.stage_name}" 19 method_path = "${aws_api_gateway_resource.test.path_part}/${aws_api_gateway_method.test.http_method}" 20 21 settings { 22 metrics_enabled = true 23 logging_level = "INFO" 24 } 25 } 26 27 resource "aws_api_gateway_rest_api" "test" { 28 name = "MyDemoAPI" 29 description = "This is my API for demonstration purposes" 30 } 31 32 resource "aws_api_gateway_deployment" "test" { 33 depends_on = ["aws_api_gateway_integration.test"] 34 rest_api_id = "${aws_api_gateway_rest_api.test.id}" 35 stage_name = "dev" 36 } 37 38 resource "aws_api_gateway_stage" "test" { 39 stage_name = "prod" 40 rest_api_id = "${aws_api_gateway_rest_api.test.id}" 41 deployment_id = "${aws_api_gateway_deployment.test.id}" 42 } 43 44 resource "aws_api_gateway_resource" "test" { 45 rest_api_id = "${aws_api_gateway_rest_api.test.id}" 46 parent_id = "${aws_api_gateway_rest_api.test.root_resource_id}" 47 path_part = "mytestresource" 48 } 49 50 resource "aws_api_gateway_method" "test" { 51 rest_api_id = "${aws_api_gateway_rest_api.test.id}" 52 resource_id = "${aws_api_gateway_resource.test.id}" 53 http_method = "GET" 54 authorization = "NONE" 55 } 56 57 resource "aws_api_gateway_integration" "test" { 58 rest_api_id = "${aws_api_gateway_rest_api.test.id}" 59 resource_id = "${aws_api_gateway_resource.test.id}" 60 http_method = "${aws_api_gateway_method.test.http_method}" 61 type = "MOCK" 62 63 request_templates { 64 "application/xml" = <<EOF 65 { 66 "body" : $input.json('$') 67 } 68 EOF 69 } 70 } 71 ``` 72 73 ## Argument Reference 74 75 The following arguments are supported: 76 77 * `rest_api_id` - (Required) The ID of the REST API 78 * `stage_name` - (Required) The name of the stage 79 * `method_path` - (Required) Method path defined as `{resource_path}/{http_method}` for an individual method override, or `*/*` for overriding all methods in the stage. 80 * `settings` - (Required) The settings block, see below. 81 82 ### `settings` 83 84 * `metrics_enabled` - (Optional) Specifies whether Amazon CloudWatch metrics are enabled for this method. 85 * `logging_level` - (Optional) Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs. The available levels are `OFF`, `ERROR`, and `INFO`. 86 * `data_trace_enabled` - (Optional) Specifies whether data trace logging is enabled for this method, which effects the log entries pushed to Amazon CloudWatch Logs. 87 * `throttling_burst_limit` - (Optional) Specifies the throttling burst limit. 88 * `throttling_rate_limit` - (Optional) Specifies the throttling rate limit. 89 * `caching_enabled` - (Optional) Specifies whether responses should be cached and returned for requests. A cache cluster must be enabled on the stage for responses to be cached. 90 * `cache_ttl_in_seconds` - (Optional) Specifies the time to live (TTL), in seconds, for cached responses. The higher the TTL, the longer the response will be cached. 91 * `cache_data_encrypted` - (Optional) Specifies whether the cached responses are encrypted. 92 * `require_authorization_for_cache_control` - (Optional) Specifies whether authorization is required for a cache invalidation request. 93 * `unauthorized_cache_control_header_strategy` - (Optional) Specifies how to handle unauthorized requests for cache invalidation. The available values are `FAIL_WITH_403`, `SUCCEED_WITH_RESPONSE_HEADER`, `SUCCEED_WITHOUT_RESPONSE_HEADER`.