Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Switch ECS module sources back to main project and off the forked copy; pin Aurora version #133

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1
rev: v1.77.2
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
5 changes: 3 additions & 2 deletions examples/backend-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ resource "aws_service_discovery_service" "this" {
}

module "ecs_service_definition" {
source = "github.com/clowdhaus/terraform-aws-ecs//modules/service?ref=73acc1d"
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "~> 5.0"

deployment_controller = "ECS"

name = local.name
desired_count = 3
cluster = data.aws_ecs_cluster.core_infra.cluster_name
cluster_arn = data.aws_ecs_cluster.core_infra.arn
enable_autoscaling = false

subnet_ids = data.aws_subnets.private.ids
Expand Down
37 changes: 24 additions & 13 deletions examples/backstage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ locals {
################################################################################

module "aurora_postgresdb" {
source = "terraform-aws-modules/rds-aurora/aws"
source = "terraform-aws-modules/rds-aurora/aws"
version = "~> 8.0"

name = "backstage-db"
engine = "aurora-postgresql"
engine_mode = "serverless"

vpc_id = data.aws_vpc.vpc.id
subnets = data.aws_subnets.private.ids

allowed_cidr_blocks = [for s in data.aws_subnet.private_cidr : s.cidr_block]
security_group_rules = {
private_subnets_ingress = {
description = "Allow ingress from VPC private subnets"
cidr_blocks = [for s in data.aws_subnet.private_cidr : s.cidr_block]
}
}

storage_encrypted = true
apply_immediately = true
Expand All @@ -42,10 +47,9 @@ module "aurora_postgresdb" {
max_capacity = 2
}

create_random_password = false
master_username = "postgres"
master_password = data.aws_secretsmanager_secret_version.postgresdb_master_password.secret_string
port = 5432
master_username = "postgres"
master_password = data.aws_secretsmanager_secret_version.postgresdb_master_password.secret_string
port = 5432

tags = local.tags
}
Expand Down Expand Up @@ -141,11 +145,12 @@ resource "aws_service_discovery_service" "this" {
}

module "ecs_service_definition" {
source = "github.com/clowdhaus/terraform-aws-ecs//modules/service?ref=73acc1d"
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "~> 5.0"

name = local.name
desired_count = 3
cluster = data.aws_ecs_cluster.core_infra.cluster_name
cluster_arn = data.aws_ecs_cluster.core_infra.arn

subnet_ids = data.aws_subnets.private.ids
security_group_rules = {
Expand Down Expand Up @@ -180,10 +185,16 @@ module "ecs_service_definition" {
enable_execute_command = true
create_iam_role = false
task_exec_iam_role_arn = one(data.aws_iam_roles.ecs_core_infra_exec_role.arns)
task_exec_secret_arns = [data.aws_secretsmanager_secret.github_token.arn, data.aws_secretsmanager_secret.postgresdb_master_password.arn]
task_exec_ssm_param_arns = [aws_ssm_parameter.base_url.arn, aws_ssm_parameter.postgres_host.arn,
aws_ssm_parameter.postgres_port.arn, aws_ssm_parameter.postgres_user.arn]

task_exec_secret_arns = [
data.aws_secretsmanager_secret.github_token.arn,
data.aws_secretsmanager_secret.postgresdb_master_password.arn,
]
task_exec_ssm_param_arns = [
aws_ssm_parameter.base_url.arn,
aws_ssm_parameter.postgres_host.arn,
aws_ssm_parameter.postgres_port.arn,
aws_ssm_parameter.postgres_user.arn,
]

container_definitions = {
main_container = {
Expand Down
2 changes: 1 addition & 1 deletion examples/core-infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ terraform destroy

| Name | Source | Version |
|------|--------|---------|
| <a name="module_ecs"></a> [ecs](#module\_ecs) | github.com/clowdhaus/terraform-aws-ecs | 73acc1d |
| <a name="module_ecs"></a> [ecs](#module\_ecs) | terraform-aws-modules/ecs/aws | ~> 5.0 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.0 |

## Resources
Expand Down
4 changes: 2 additions & 2 deletions examples/core-infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ locals {
################################################################################

module "ecs" {
source = "github.com/clowdhaus/terraform-aws-ecs?ref=73acc1d"
# version = "~> 4.0"
source = "terraform-aws-modules/ecs/aws"
version = "~> 5.0"

cluster_name = local.name

Expand Down
11 changes: 7 additions & 4 deletions examples/graviton/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,12 @@ resource "aws_service_discovery_service" "arm64" {
}

module "ecs_service_definition_amd64" {
source = "github.com/clowdhaus/terraform-aws-ecs//modules/service?ref=73acc1d"
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "~> 5.0"

name = local.name
desired_count = 3
cluster = data.aws_ecs_cluster.core_infra.cluster_name
cluster_arn = data.aws_ecs_cluster.core_infra.arn

subnet_ids = data.aws_subnets.private.ids
security_group_rules = {
Expand Down Expand Up @@ -238,10 +239,12 @@ module "ecs_service_definition_amd64" {
}

module "ecs_service_definition_arm64" {
source = "github.com/clowdhaus/terraform-aws-ecs//modules/service?ref=73acc1d"
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "~> 5.0"

name = "${local.name}-arm64"
desired_count = 3
cluster = data.aws_ecs_cluster.core_infra.cluster_name
cluster_arn = data.aws_ecs_cluster.core_infra.arn

subnet_ids = data.aws_subnets.private.ids
security_group_rules = {
Expand Down
5 changes: 3 additions & 2 deletions examples/lb-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ resource "aws_service_discovery_service" "this" {
}

module "ecs_service_definition" {
source = "github.com/clowdhaus/terraform-aws-ecs//modules/service?ref=73acc1d"
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "~> 5.0"

name = local.name
desired_count = 3
cluster = data.aws_ecs_cluster.core_infra.cluster_name
cluster_arn = data.aws_ecs_cluster.core_infra.arn
enable_autoscaling = false

subnet_ids = data.aws_subnets.private.ids
Expand Down
5 changes: 3 additions & 2 deletions examples/prometheus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ resource "aws_service_discovery_service" "this" {
}

module "ecs_service_definition" {
source = "github.com/clowdhaus/terraform-aws-ecs//modules/service?ref=73acc1d"
source = "terraform-aws-modules/ecs/aws//modules/service"
version = "~> 5.0"

name = local.name
desired_count = 1
cluster = data.aws_ecs_cluster.core_infra.cluster_name
cluster_arn = data.aws_ecs_cluster.core_infra.arn

subnet_ids = data.aws_subnets.private.ids
security_group_rules = {
Expand Down