Skip to content

Add terraform deployment option #25

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
17 changes: 17 additions & 0 deletions terraform/deploy/ec2_elastic_compute_cloud.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "aws_eip" "shared_resources_ekkosharedvpc_publicsubnet1" {
tags = {
Name = "shared-resources/EkkoSharedVpc/PublicSubnet1"
service = "ekko"
}

tags_all = {
Name = "shared-resources/EkkoSharedVpc/PublicSubnet1"
service = "ekko"
}

network_border_group = aws_s3_bucket.shared_resources_ekkobucket331a3a61_dexqbg3bet5j.region
network_interface = "eni-0f6e9c1fe914b95c0"
public_ipv4_pool = "amazon"
vpc = true
}

79 changes: 79 additions & 0 deletions terraform/deploy/ecs_elastic_container.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
resource "aws_ecs_cluster" "shared_resources_ekkosharedcluster4120c207_48twmhcfmggy" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

name = "shared-resources-EkkoSharedCluster4120C207-48twmHcfmggy"
setting {
name = "containerInsights"
value = "disabled"
}

}

resource "aws_ecs_service" "shared_resources_ekkosharedcluster4120c207_48twmhcfmggy_ekkoserver" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

cluster = aws_ecs_cluster.shared_resources_ekkosharedcluster4120c207_48twmhcfmggy.arn
deployment_circuit_breaker {
enable = false
rollback = false
}

deployment_controller {
type = "ECS"
}

deployment_maximum_percent = 200
deployment_minimum_healthy_percent = 50
desired_count = 1
health_check_grace_period_seconds = 60
iam_role = "aws-service-role"
launch_type = "FARGATE"
load_balancer {
container_name = "ekkoServiceContainer"
container_port = 80
target_group_arn = aws_alb_target_group.arn_aws_elasticloadbalancing_eu_north_1_746690549776_targetgroup_ekko_s_ekkos_s7njknjrvurv_7aab81bf49e7fd51.arn
}

name = "ekkoServer"
network_configuration {
security_groups = [aws_security_group.sg_0458286e5ac70e244.id]
subnets = [aws_subnet.shared_resources_ekkosharedvpc_privatesubnet1.id, aws_subnet.shared_resources_ekkosharedvpc_privatesubnet2.id]
}

platform_version = "LATEST"
propagate_tags = "NONE"
scheduling_strategy = "REPLICA"
task_definition = "ekkoserverekkoServiceTaskDefinition1784AEED:1"
}

resource "aws_ecs_task_definition" "arn_aws_ecs_eu_north_1_746690549776_task_definition_ekkoserverekkoservicetaskdefinition1784aeed_1" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

container_definitions = "[{\"command\":[],\"cpu\":0,\"dnsSearchDomains\":[],\"dnsServers\":[],\"dockerLabels\":{},\"dockerSecurityOptions\":[],\"entryPoint\":[],\"environment\":[{\"name\":\"PORT\",\"value\":\"80\"},{\"name\":\"REDIS_ENDPOINT\",\"value\":\"sha-re-11moaiyqzemmh.2xivwj.0001.eun1.cache.amazonaws.com\"},{\"name\":\"REDIS_PORT\",\"value\":\"6379\"},{\"name\":\"S3_BUCKET\",\"value\":\"shared-resources-ekkobucket331a3a61-dexqbg3bet5j\"},{\"name\":\"SECRET_KEY\",\"value\":\"e73214269f48a8fb84f8a0dd730fe0ca149c8090526f85e8ce7c76624ce36a56\"}],\"environmentFiles\":[],\"essential\":true,\"extraHosts\":[],\"image\":\"public.ecr.aws/u0n8j4n8/ekko:latest\",\"links\":[],\"logConfiguration\":{\"logDriver\":\"awslogs\",\"options\":{\"awslogs-group\":\"ekko-server-ekkoServiceTaskDefinitionekkoServiceContainerLogGroup8EAB83C5-5ZCRReQ1Vjb7\",\"awslogs-region\":\"eu-north-1\",\"awslogs-stream-prefix\":\"ekko-server\"},\"secretOptions\":[]},\"mountPoints\":[],\"name\":\"ekkoServiceContainer\",\"portMappings\":[{\"containerPort\":80,\"hostPort\":80,\"protocol\":\"tcp\"}],\"secrets\":[],\"systemControls\":[],\"ulimits\":[{\"hardLimit\":65500,\"name\":\"nofile\",\"softLimit\":50000}],\"volumesFrom\":[]}]"
cpu = "1024"
execution_role_arn = aws_iam_role.ekko_server_ekkoservicetaskdefinitionexecutionrole_ldj5x1reqaie.arn
family = "ekkoserverekkoServiceTaskDefinition1784AEED"
memory = "2048"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
task_role_arn = aws_iam_role.ekko_server_ekkoservicetaskdefinitiontaskroleee32f_1relgzo9yar29.arn
}

25 changes: 25 additions & 0 deletions terraform/deploy/elasti_cache.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "aws_elasticache_cluster" "sha_re_11moaiyqzemmh" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

auto_minor_version_upgrade = aws_vpc.shared_resources_ekkosharedvpc.enable_dns_hostnames
availability_zone = "eu-north-1a"
az_mode = "single-az"
cluster_id = "sha-re-11moaiyqzemmh"
engine = "redis"
engine_version = "7.x"
maintenance_window = "sat:03:30-sat:04:30"
node_type = "cache.t3.micro"
num_cache_nodes = 1
parameter_group_name = "default.redis7"
port = 6379
security_group_ids = [aws_security_group.sg_0f4110ea36b08f242.id]
snapshot_window = "01:00-02:00"
subnet_group_name = "shared-resources-redisredissubnetgroup11af7b54-0bjd85c5swbk"
}

69 changes: 69 additions & 0 deletions terraform/deploy/elb_elastic_load_balancing.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
resource "aws_alb" "arn_aws_elasticloadbalancing_eu_north_1_746690549776_loadbalancer_app_ekko_ekkos_k40fqb6cs3yf_994e8a2228693472" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

access_logs {
bucket = ""
}

desync_mitigation_mode = "defensive"
enable_cross_zone_load_balancing = true
enable_http2 = true
idle_timeout = 75
ip_address_type = "ipv4"
load_balancer_type = "application"
name = "ekko-ekkos-K40FQB6CS3YF"
security_groups = [aws_security_group.sg_01571e98a600a79c3.id]
subnet_mapping {
subnet_id = aws_subnet.shared_resources_ekkosharedvpc_publicsubnet2.id
}

subnet_mapping {
subnet_id = aws_subnet.shared_resources_ekkosharedvpc_publicsubnet1.id
}

subnets = ["subnet-0e45388e9397e29c3", "subnet-02a94b7b196aa551f"]
}

resource "aws_alb_target_group" "arn_aws_elasticloadbalancing_eu_north_1_746690549776_targetgroup_ekko_s_ekkos_s7njknjrvurv_7aab81bf49e7fd51" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

deregistration_delay = "300"
health_check {
enabled = true
healthy_threshold = 5
interval = 30
matcher = "200"
path = "/"
port = "traffic-port"
protocol = "HTTP"
timeout = 5
unhealthy_threshold = 2
}

load_balancing_algorithm_type = "round_robin"
name = "ekko-s-ekkos-S7NJKNJRVURV"
port = 80
protocol = "HTTP"
protocol_version = "HTTP1"
stickiness {
cookie_duration = 259200
enabled = true
type = "lb_cookie"
}

target_type = "ip"
vpc_id = aws_vpc.shared_resources_ekkosharedvpc.id
}

77 changes: 77 additions & 0 deletions terraform/deploy/iam_identity_access_management.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
resource "aws_iam_role" "ekko_server_ekkoservicetaskdefinitionexecutionrole_ldj5x1reqaie" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"ecs-tasks.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
inline_policy {
name = "ekkoServiceTaskDefinitionExecutionRoleDefaultPolicyD1D16612"
policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"logs:CreateLogStream\",\"logs:PutLogEvents\"],\"Resource\":\"arn:aws:logs:eu-north-1:746690549776:log-group:ekko-server-ekkoServiceTaskDefinitionekkoServiceContainerLogGroup8EAB83C5-5ZCRReQ1Vjb7:*\",\"Effect\":\"Allow\"}]}"
}

max_session_duration = 3600
name = "ekko-server-ekkoServiceTaskDefinitionExecutionRole-LDJ5X1REQAIE"
path = "/"
}

resource "aws_iam_role" "ekko_server_ekkoservicetaskdefinitiontaskroleee32f_1relgzo9yar29" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"ecs-tasks.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
inline_policy {
}

managed_policy_arns = ["arn:aws:iam::aws:policy/AWSLambda_FullAccess", "arn:aws:iam::aws:policy/AmazonS3FullAccess"]
max_session_duration = 3600
name = "ekko-server-ekkoServiceTaskDefinitionTaskRoleEE32F-1RELGZO9YAR29"
path = "/"
}

resource "aws_iam_role" "ekko_server_lambdabasicexecution61fa4ad4_4sfg010hehba" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
inline_policy {
}

managed_policy_arns = ["arn:aws:iam::aws:policy/AWSLambda_FullAccess"]
max_session_duration = 3600
name = "ekko-server-lambdabasicexecution61FA4AD4-4SFG010HEHBA"
path = "/"
}

resource "aws_iam_role" "shared_resources_customs3autodeleteobjectscustomre_1od701gau16hh" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}"
inline_policy {
}

managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
max_session_duration = 3600
name = "shared-resources-CustomS3AutoDeleteObjectsCustomRe-1OD701GAU16HH"
path = "/"
}

30 changes: 30 additions & 0 deletions terraform/deploy/lambda.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "aws_lambda_function" "shared_resources_customs3autodeleteobjectscustomre_t99ivmzy1pkf" {
tags = {
service = "ekko"
}

tags_all = {
service = "ekko"
}

architectures = ["x86_64"]
description = "Lambda function for auto-deleting objects in shared-resources-ekkobucket331a3a61-dexqbg3bet5j S3 bucket."
ephemeral_storage {
size = 512
}

function_name = "shared-resources-CustomS3AutoDeleteObjectsCustomRe-T99ivMzy1PKf"
handler = "__entrypoint__.handler"
memory_size = 128
package_type = "Zip"
reserved_concurrent_executions = -1
role = aws_iam_role.shared_resources_customs3autodeleteobjectscustomre_1od701gau16hh.arn
runtime = "nodejs14.x"
source_code_hash = "6Nwpw89YlhHQnlxR+8libqb1UVPUBWEeY0f+4JAk0aU="
timeout = 900
tracing_config {
mode = "PassThrough"
}

}

30 changes: 30 additions & 0 deletions terraform/deploy/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.2.0"
}
}
}

# Configure the AWS Provider
provider "aws" {
region = "eu-north-1"
default_tags {
tags = {
service = "ekko"
}
}
}


# SHARED RESOURCES

resource "aws_s3_bucket" "shared_resources_ekko" {

bucket = "shared_resources_ekko"
}


# EKKO STACK

4 changes: 4 additions & 0 deletions terraform/deploy/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# output for eks cluster
output "shared_resources_s3_bucket_name" {
value = data.aws_s3_bucket.shared_resources_ekko.bucket
}
Loading