Skip to content

Commit

Permalink
Merge pull request #26 from zebrunner/develop
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
vdelendik authored Sep 9, 2024
2 parents 3ef1e7e + 4b271ff commit a8357e4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deploy/cloudwatch.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_vpc_endpoint" "cloudwatch" {
count = var.enable_cloudwatch && var.nat ? 1 : 0
count = var.enable_cloudwatch && var.nat ? 1 : 0

vpc_id = aws_vpc.main.id
subnet_ids = [for s in aws_subnet.private_per_zone : s.id]
Expand Down
6 changes: 4 additions & 2 deletions deploy/e3s.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
subnets_arr = [ for subnet in aws_subnet.public_per_zone : subnet.id ]
subnets_arr = [for subnet in aws_subnet.public_per_zone : subnet.id]
}

resource "tls_private_key" "pri_key" {
Expand Down Expand Up @@ -93,6 +93,8 @@ resource "aws_instance" "e3s_server" {
bucket_region = length(aws_s3_bucket.main) > 0 ? var.region : var.bucket.region
log_group = length(aws_cloudwatch_log_group.e3s_tasks) > 0 ? local.e3s_log_group_name : ""

nat = var.nat

zbr_host = var.zebrunner.host
zbr_user = var.zebrunner.user
zbr_pass = var.zebrunner.pass
Expand All @@ -114,6 +116,6 @@ resource "aws_instance" "e3s_server" {
depends_on = [aws_ecs_cluster.e3s, aws_lb_listener.main, aws_subnet.public_per_zone]

lifecycle {
ignore_changes = [user_data]
ignore_changes = [user_data, ami]
}
}
12 changes: 12 additions & 0 deletions deploy/ec2_data/e3s_user_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ case ${remote_data} in
;;
esac

case ${nat} in
(true)
replace "SERVICE_STARTUP_TIMEOUT" "5m45s" "./properties/router.env"
;;
(false)
replace "SERVICE_STARTUP_TIMEOUT" "10m" "./properties/router.env"
;;
(*)
echo "nat is not a bool value"
;;
esac

# config.env
replace "AWS_REGION" ${region} "./properties/config.env"
replace "AWS_CLUSTER" ${cluster_name} "./properties/config.env"
Expand Down
2 changes: 1 addition & 1 deletion deploy/rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resource "aws_db_subnet_group" "rds" {
name = local.e3s_rds_subnet_name
description = "RDS subnet group"
subnet_ids = length(aws_subnet.private_per_zone) != 0 ? [for s in aws_subnet.private_per_zone : s.id] : [for s in aws_subnet.public_per_zone : s.id]
depends_on = [aws_subnet.private_per_zone, aws_subnet.public_per_zone]
depends_on = [aws_subnet.private_per_zone, aws_subnet.public_per_zone]
}

resource "aws_db_instance" "postgres" {
Expand Down
2 changes: 1 addition & 1 deletion deploy/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_s3_bucket" "main" {
}

resource "aws_s3_bucket_policy" "vpc_restrict_policy" {
count = var.bucket.exists || length(aws_vpc_endpoint.s3_gw) == 0 ? 0 : 1
count = var.bucket.exists || length(aws_vpc_endpoint.s3_gw) == 0 ? 0 : 1
bucket = var.bucket.name
policy = templatefile("./iam_data/s3-bucket-policy.json", {
bucket_name = var.bucket.name
Expand Down
2 changes: 1 addition & 1 deletion deploy/security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ resource "aws_security_group" "cloudwatch" {
}

resource "aws_vpc_security_group_ingress_rule" "cloudwatch" {
count = length(aws_security_group.cloudwatch) != 0 ? 1 : 0
count = length(aws_security_group.cloudwatch) != 0 ? 1 : 0
security_group_id = aws_security_group.cloudwatch[0].id
ip_protocol = "-1"
referenced_security_group_id = aws_security_group.e3s_agent.id
Expand Down

0 comments on commit a8357e4

Please sign in to comment.