Skip to content

Commit

Permalink
ready for production rollout
Browse files Browse the repository at this point in the history
ideally i would refactor this in to a TF module, i'll do that in the
future
  • Loading branch information
Steve Huff committed Aug 25, 2017
1 parent 1b65c6c commit c20f0ce
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions env-production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@ resource "aws_api_gateway_stage" "prod" {
stage_name = "prod"
deployment_id = "${aws_api_gateway_deployment.prod.id}"
cache_cluster_enabled = false
cache_cluster_size = "0.5"

lifecycle {
create_before_destroy = true
}
}

resource "aws_api_gateway_deployment" "prod" {
rest_api_id = "${aws_api_gateway_rest_api.webapi.id}"
description = "Deployment of webapi prod"
description = "Deployment of webapi prod - ${md5(file("main.tf"))}"
stage_name = "prod"
stage_description = "Prod stage for webapi"
stage_description = "Deployment of webapi prod - ${md5(file("main.tf"))}"

depends_on = ["aws_api_gateway_integration.proxy-any"]

lifecycle {
create_before_destroy = true
}
}

resource "aws_api_gateway_resource" "proxy" {
Expand All @@ -56,10 +65,12 @@ resource "aws_api_gateway_method_settings" "proxy-any" {
method_path = "*/*"

settings {
metrics_enabled = true
logging_level = "ERROR"
data_trace_enabled = false
caching_enabled = false
metrics_enabled = true
logging_level = "INFO"
data_trace_enabled = true
caching_enabled = false
throttling_rate_limit = 10000
throttling_burst_limit = 5000
}
}

Expand All @@ -77,6 +88,20 @@ resource "aws_api_gateway_integration" "proxy-any" {
}
}

resource "aws_api_gateway_method_response" "proxy-200" {
rest_api_id = "${aws_api_gateway_rest_api.webapi.id}"
resource_id = "${aws_api_gateway_resource.proxy.id}"
http_method = "${aws_api_gateway_method.proxy-any.http_method}"
status_code = "200"
}

resource "aws_api_gateway_integration_response" "proxy-200" {
rest_api_id = "${aws_api_gateway_rest_api.webapi.id}"
resource_id = "${aws_api_gateway_resource.proxy.id}"
http_method = "${aws_api_gateway_method.proxy-any.http_method}"
status_code = "${aws_api_gateway_method_response.proxy-200.status_code}"
}

resource "aws_api_gateway_domain_name" "webapi" {
domain_name = "fitnesskeeperapi.com"
certificate_arn = "${data.aws_acm_certificate.webapi.arn}"
Expand Down

0 comments on commit c20f0ce

Please sign in to comment.