Skip to content

Commit

Permalink
Merge pull request #54 from turnerlabs/fix/region
Browse files Browse the repository at this point in the history
works with other regions
  • Loading branch information
jritsema authored May 29, 2020
2 parents 1b932eb + 648a07c commit 501afa4
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.6
0.12.26
2 changes: 1 addition & 1 deletion base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $ terraform apply
| app | Name of the application. This value should usually match the application tag below. | string | | yes |
| aws_profile | The AWS profile to use, this would be the same value used in AWS_PROFILE. | string | | yes |
| image_tag_mutability | The tag mutability setting for the repository. | string | IMMUTABLE | |
| region | The AWS region to use for the bucket and registry; typically `us-east-1`. Other possible values: `us-east-2`, `us-west-1`, or `us-west-2`. <br>Currently, Fargate is only available in `us-east-1`. | string | `us-east-1` | |
| region | The AWS region to use for the bucket and registry. | string | `us-east-1` | |
| saml_role | The role that will have access to the S3 bucket, this should be a role that all members of the team have access to. | string | | yes |
| tags | A map of the tags to apply to various resources. The required tags are: <br>+ `application`, name of the app <br>+ `environment`, the environment being created <br>+ `team`, team responsible for the application <br>+ `contact-email`, contact email for the _team_ <br>+ `customer`, who the application was create for | map | `<map>` | yes |

Expand Down
2 changes: 1 addition & 1 deletion base/state.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# s3 bucket for tf remote state
module "tf_remote_state" {
source = "github.com/turnerlabs/terraform-remote-state?ref=v2.2.0"
source = "github.com/turnerlabs/terraform-remote-state?ref=v3.0.0"

role = var.saml_role
application = var.app
Expand Down
4 changes: 1 addition & 3 deletions base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* Common variables to use in various Terraform files (*.tf)
*/

# The AWS region to use for the bucket and registry; typically `us-east-1`.
# Other possible values: `us-east-2`, `us-west-1`, or `us-west-2`.
# Currently, Fargate is only available in `us-east-1`.
# The AWS region to use for the bucket and registry
variable "region" {
default = "us-east-1"
}
Expand Down
2 changes: 1 addition & 1 deletion env/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $ terraform apply
| logz_url | The endpoint to use for sending logs to Logz.io | string | `https://listener.logz.io:8071` | no |
| private_subnets | The private subnets, minimum of 2, that are a part of the VPC(s) | string | - | yes |
| public_subnets | The public subnets, minimum of 2, that are a part of the VPC(s) | string | - | yes |
| region | The AWS region to use for the dev environment's infrastructure Currently, Fargate is only available in `us-east-1`. | string | `us-east-1` | no |
| region | The AWS region to use for the dev environment's infrastructure`. | string | `us-east-1` | no |
| replicas | How many containers to run | string | `1` | no |
| saml_role | The SAML role to use for adding users to the ECR policy | string | - | yes |
| scale_down_cron | Default scale down at 7 pm every day | string | `cron(0 23 * * ? *)` | no |
Expand Down
2 changes: 1 addition & 1 deletion env/dev/dashboard.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ resource "aws_cloudwatch_dashboard" "cloudwatch_dashboard" {
dashboard_name = "${var.app}-${var.environment}-fargate"

dashboard_body = <<EOF
{"widgets":[{"type":"metric","x":12,"y":6,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":false,"metrics":[["AWS/ECS","MemoryUtilization","ServiceName","${var.app}-${var.environment}","ClusterName","${var.app}-${var.environment}",{"color":"#1f77b4"}],[".","CPUUtilization",".",".",".",".",{"color":"#9467bd"}]],"region":"us-east-1","period":300,"title":"Memory and CPU utilization","yAxis":{"left":{"min":0,"max":100}}}},{"type":"metric","x":0,"y":6,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":true,"metrics":[["AWS/ApplicationELB","HTTPCode_Target_5XX_Count","TargetGroup","${aws_alb_target_group.main.arn_suffix}","LoadBalancer","${aws_alb.main.arn_suffix}",{"period":60,"color":"#d62728","stat":"Sum"}],[".","HTTPCode_Target_4XX_Count",".",".",".",".",{"period":60,"stat":"Sum","color":"#bcbd22"}],[".","HTTPCode_Target_3XX_Count",".",".",".",".",{"period":60,"stat":"Sum","color":"#98df8a"}],[".","HTTPCode_Target_2XX_Count",".",".",".",".",{"period":60,"stat":"Sum","color":"#2ca02c"}]],"region":"us-east-1","title":"Container responses","period":300,"yAxis":{"left":{"min":0}}}},{"type":"metric","x":12,"y":0,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":false,"metrics":[["AWS/ApplicationELB","TargetResponseTime","LoadBalancer","${aws_alb.main.arn_suffix}",{"period":60,"stat":"p50"}],["...",{"period":60,"stat":"p90","color":"#c5b0d5"}],["...",{"period":60,"stat":"p99","color":"#dbdb8d"}]],"region":"us-east-1","period":300,"yAxis":{"left":{"min":0,"max":3}},"title":"Container response times"}},{"type":"metric","x":12,"y":12,"width":12,"height":2,"properties":{"view":"singleValue","metrics":[["AWS/ApplicationELB","HealthyHostCount","TargetGroup","${aws_alb_target_group.main.arn_suffix}","LoadBalancer","${aws_alb.main.arn_suffix}",{"color":"#2ca02c","period":60}],[".","UnHealthyHostCount",".",".",".",".",{"color":"#d62728","period":60}]],"region":"us-east-1","period":300,"stacked":false}},{"type":"metric","x":0,"y":0,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":true,"metrics":[["AWS/ApplicationELB","HTTPCode_Target_5XX_Count","LoadBalancer","${aws_alb.main.arn_suffix}",{"period":60,"stat":"Sum","color":"#d62728"}],[".","HTTPCode_Target_4XX_Count",".",".",{"period":60,"stat":"Sum","color":"#bcbd22"}],[".","HTTPCode_Target_3XX_Count",".",".",{"period":60,"stat":"Sum","color":"#98df8a"}],[".","HTTPCode_Target_2XX_Count",".",".",{"period":60,"stat":"Sum","color":"#2ca02c"}]],"region":"us-east-1","title":"Load balancer responses","period":300,"yAxis":{"left":{"min":0}}}}]}
{"widgets":[{"type":"metric","x":12,"y":6,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":false,"metrics":[["AWS/ECS","MemoryUtilization","ServiceName","${var.app}-${var.environment}","ClusterName","${var.app}-${var.environment}",{"color":"#1f77b4"}],[".","CPUUtilization",".",".",".",".",{"color":"#9467bd"}]],"region":"${var.region}","period":300,"title":"Memory and CPU utilization","yAxis":{"left":{"min":0,"max":100}}}},{"type":"metric","x":0,"y":6,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":true,"metrics":[["AWS/ApplicationELB","HTTPCode_Target_5XX_Count","TargetGroup","${aws_alb_target_group.main.arn_suffix}","LoadBalancer","${aws_alb.main.arn_suffix}",{"period":60,"color":"#d62728","stat":"Sum"}],[".","HTTPCode_Target_4XX_Count",".",".",".",".",{"period":60,"stat":"Sum","color":"#bcbd22"}],[".","HTTPCode_Target_3XX_Count",".",".",".",".",{"period":60,"stat":"Sum","color":"#98df8a"}],[".","HTTPCode_Target_2XX_Count",".",".",".",".",{"period":60,"stat":"Sum","color":"#2ca02c"}]],"region":"${var.region}","title":"Container responses","period":300,"yAxis":{"left":{"min":0}}}},{"type":"metric","x":12,"y":0,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":false,"metrics":[["AWS/ApplicationELB","TargetResponseTime","LoadBalancer","${aws_alb.main.arn_suffix}",{"period":60,"stat":"p50"}],["...",{"period":60,"stat":"p90","color":"#c5b0d5"}],["...",{"period":60,"stat":"p99","color":"#dbdb8d"}]],"region":"${var.region}","period":300,"yAxis":{"left":{"min":0,"max":3}},"title":"Container response times"}},{"type":"metric","x":12,"y":12,"width":12,"height":2,"properties":{"view":"singleValue","metrics":[["AWS/ApplicationELB","HealthyHostCount","TargetGroup","${aws_alb_target_group.main.arn_suffix}","LoadBalancer","${aws_alb.main.arn_suffix}",{"color":"#2ca02c","period":60}],[".","UnHealthyHostCount",".",".",".",".",{"color":"#d62728","period":60}]],"region":"${var.region}","period":300,"stacked":false}},{"type":"metric","x":0,"y":0,"width":12,"height":6,"properties":{"view":"timeSeries","stacked":true,"metrics":[["AWS/ApplicationELB","HTTPCode_Target_5XX_Count","LoadBalancer","${aws_alb.main.arn_suffix}",{"period":60,"stat":"Sum","color":"#d62728"}],[".","HTTPCode_Target_4XX_Count",".",".",{"period":60,"stat":"Sum","color":"#bcbd22"}],[".","HTTPCode_Target_3XX_Count",".",".",{"period":60,"stat":"Sum","color":"#98df8a"}],[".","HTTPCode_Target_2XX_Count",".",".",{"period":60,"stat":"Sum","color":"#2ca02c"}]],"region":"${var.region}","title":"Load balancer responses","period":300,"yAxis":{"left":{"min":0}}}}]}
EOF
}
2 changes: 1 addition & 1 deletion env/dev/ecs-event-stream.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ resource "aws_cloudwatch_dashboard" "ecs-event-stream" {
"height": 18,
"properties": {
"query": "SOURCE '/aws/lambda/${var.app}-${var.environment}-ecs-event-stream' | fields @timestamp as time, detail.desiredStatus as desired, detail.lastStatus as latest, detail.stoppedReason as reason, detail.containers.0.reason as container_reason, detail.taskDefinitionArn as task_definition\n| filter @type != \"START\" and @type != \"END\" and @type != \"REPORT\"\n| sort detail.updatedAt desc, detail.version desc\n| limit 100",
"region": "us-east-1",
"region": "${var.region}",
"title": "ECS Event Log"
}
}
Expand Down
2 changes: 1 addition & 1 deletion env/dev/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ resource "aws_ecs_task_definition" "app" {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/fargate/service/${var.app}-${var.environment}",
"awslogs-region": "us-east-1",
"awslogs-region": "${var.region}",
"awslogs-stream-prefix": "ecs"
}
}
Expand Down
4 changes: 2 additions & 2 deletions env/dev/secrets-sidecar.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ resource "aws_ecs_task_definition" "secrets_sidecar" {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${local.logs_group}",
"awslogs-region": "us-east-1",
"awslogs-region": "${var.region}",
"awslogs-stream-prefix": "ecs"
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ resource "aws_ecs_task_definition" "secrets_sidecar" {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${local.logs_group}",
"awslogs-region": "us-east-1",
"awslogs-region": "${var.region}",
"awslogs-stream-prefix": "ecs"
}
}
Expand Down
1 change: 0 additions & 1 deletion env/dev/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

# The AWS region to use for the dev environment's infrastructure
# Currently, Fargate is only available in `us-east-1`.
variable "region" {
default = "us-east-1"
}
Expand Down

0 comments on commit 501afa4

Please sign in to comment.