diff --git a/.gitignore b/.gitignore index e69de29..0b1c871 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,10 @@ +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +**/.idea/* +.idea +.idea/workspace.xml \ No newline at end of file diff --git a/configuration/app_ecs_service_role.tpl b/configuration/app_ecs_service_role.tpl new file mode 100644 index 0000000..99856ce --- /dev/null +++ b/configuration/app_ecs_service_role.tpl @@ -0,0 +1,14 @@ +{ + "Version": "2008-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": [ + "ecs.amazonaws.com" + ] + }, + "Effect": "Allow" + } + ] +} \ No newline at end of file diff --git a/configuration/app_ecs_task_definition_magento2.tpl b/configuration/app_ecs_task_definition_magento2.tpl new file mode 100644 index 0000000..9af3fe3 --- /dev/null +++ b/configuration/app_ecs_task_definition_magento2.tpl @@ -0,0 +1,95 @@ + [ + { + "name": "magento2", + "image": "${data.aws_ecr_repository.magento2.repository_url}", + "mountPoints": [ + { + "containerPath": "/var/www/html/pub/media", + "sourceVolume": "media", + "readOnly": null + } + ], + "essential": true, + "environment": [ + { + "name": "ENVIRONMENT", + "value": "${terraform.workspace}" + }, + { + "name": "MAGE_MODE", + "value": "production" + }, + { + "name": "CACHE_PREFIX", + "value": "1_" + }, + { + "name": "MYSQL_HOST", + "value": "${aws_route53_record.db.fqdn}" + }, + { + "name": "MYSQL_DATABASE", + "value": "${var.env_mysql_database}" + }, + { + "name": "MYSQL_USER", + "value": "${var.env_mysql_user}" + }, + { + "name": "MYSQL_PASSWORD", + "value": "${lookup(var.rds_password, terraform.workspace)}" + }, + { + "name": "REDIS_CACHE_HOST", + "value": "${aws_route53_record.redis_cache.fqdn}" + }, + { + "name": "REDIS_SESSION_HOST", + "value": "${aws_route53_record.redis_session.fqdn}" + } + ], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "${terraform.workspace}-app", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "magento2" + } + }, + "cpu": 0, + "memoryReservation": 768 + }, + { + "name": "nginx", + "volumesFrom": [ + { + "readOnly": true, + "sourceContainer": "magento2" + } + ], + "portMappings": [ + { + "hostPort": 80, + "containerPort": 80, + "protocol": "tcp" + } + ], + "essential": true, + "environment": [], + "links": [ + "magento2:phpfpm" + ], + "image": "${data.aws_ecr_repository.nginx.repository_url}", + "command": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "${terraform.workspace}-app", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "nginx" + } + }, + "cpu": 0, + "memoryReservation": 512 + } + ] \ No newline at end of file diff --git a/configuration/app_ecs_task_role.tpl b/configuration/app_ecs_task_role.tpl new file mode 100644 index 0000000..014611f --- /dev/null +++ b/configuration/app_ecs_task_role.tpl @@ -0,0 +1,13 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] +} \ No newline at end of file diff --git a/configuration/ecs_autoscale_role.tpl b/configuration/ecs_autoscale_role.tpl new file mode 100644 index 0000000..3acddba --- /dev/null +++ b/configuration/ecs_autoscale_role.tpl @@ -0,0 +1,14 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": [ + "application-autoscaling.amazonaws.com" + ] + }, + "Effect": "Allow" + } + ] +} \ No newline at end of file diff --git a/configuration/ecs_role.tpl b/configuration/ecs_role.tpl new file mode 100644 index 0000000..a662b99 --- /dev/null +++ b/configuration/ecs_role.tpl @@ -0,0 +1,15 @@ +{ + "Version": "2008-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": [ + "ecs.amazonaws.com", + "ec2.amazonaws.com" + ] + }, + "Effect": "Allow" + } + ] +} \ No newline at end of file diff --git a/configuration/logs-policy.tpl b/configuration/logs-policy.tpl new file mode 100644 index 0000000..99776bc --- /dev/null +++ b/configuration/logs-policy.tpl @@ -0,0 +1,15 @@ +{ + "Id": "${var.project_name}-${terraform.workspace}-logs-policy", + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Stmt1484671540333", + "Action": "s3:PutObject", + "Effect": "Allow", + "Resource": "arn:aws:s3:::${var.project_name}-${terraform.workspace}-logs/*", + "Principal": { + "AWS": "arn:aws:iam::${lookup(var.default_log_account_ids, var.aws_region)}:root" + } + } + ] +} \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-cluster/README.md b/configuration/template_app_ecs_user_data.tpl similarity index 100% rename from modules/app-cluster/aws/ecs-cluster/README.md rename to configuration/template_app_ecs_user_data.tpl diff --git a/modules/app-cluster/aws/ecs-cluster/outputs.tf b/modules/app-cluster/aws/ecs-cluster/outputs.tf deleted file mode 100644 index e69de29..0000000 diff --git a/modules/app-cluster/aws/ecs-cluster/variables.tf b/modules/app-cluster/aws/ecs-cluster/variables.tf deleted file mode 100644 index e69de29..0000000 diff --git a/modules/app-cluster/aws/ecs-service/app_ecs_service_role.tpl b/modules/app-cluster/aws/ecs-service/app_ecs_service_role.tpl new file mode 100644 index 0000000..99856ce --- /dev/null +++ b/modules/app-cluster/aws/ecs-service/app_ecs_service_role.tpl @@ -0,0 +1,14 @@ +{ + "Version": "2008-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": [ + "ecs.amazonaws.com" + ] + }, + "Effect": "Allow" + } + ] +} \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-service/app_ecs_task_definition_magento2.tpl b/modules/app-cluster/aws/ecs-service/app_ecs_task_definition_magento2.tpl new file mode 100644 index 0000000..9af3fe3 --- /dev/null +++ b/modules/app-cluster/aws/ecs-service/app_ecs_task_definition_magento2.tpl @@ -0,0 +1,95 @@ + [ + { + "name": "magento2", + "image": "${data.aws_ecr_repository.magento2.repository_url}", + "mountPoints": [ + { + "containerPath": "/var/www/html/pub/media", + "sourceVolume": "media", + "readOnly": null + } + ], + "essential": true, + "environment": [ + { + "name": "ENVIRONMENT", + "value": "${terraform.workspace}" + }, + { + "name": "MAGE_MODE", + "value": "production" + }, + { + "name": "CACHE_PREFIX", + "value": "1_" + }, + { + "name": "MYSQL_HOST", + "value": "${aws_route53_record.db.fqdn}" + }, + { + "name": "MYSQL_DATABASE", + "value": "${var.env_mysql_database}" + }, + { + "name": "MYSQL_USER", + "value": "${var.env_mysql_user}" + }, + { + "name": "MYSQL_PASSWORD", + "value": "${lookup(var.rds_password, terraform.workspace)}" + }, + { + "name": "REDIS_CACHE_HOST", + "value": "${aws_route53_record.redis_cache.fqdn}" + }, + { + "name": "REDIS_SESSION_HOST", + "value": "${aws_route53_record.redis_session.fqdn}" + } + ], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "${terraform.workspace}-app", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "magento2" + } + }, + "cpu": 0, + "memoryReservation": 768 + }, + { + "name": "nginx", + "volumesFrom": [ + { + "readOnly": true, + "sourceContainer": "magento2" + } + ], + "portMappings": [ + { + "hostPort": 80, + "containerPort": 80, + "protocol": "tcp" + } + ], + "essential": true, + "environment": [], + "links": [ + "magento2:phpfpm" + ], + "image": "${data.aws_ecr_repository.nginx.repository_url}", + "command": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "${terraform.workspace}-app", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "nginx" + } + }, + "cpu": 0, + "memoryReservation": 512 + } + ] \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-service/app_ecs_task_role.tpl b/modules/app-cluster/aws/ecs-service/app_ecs_task_role.tpl new file mode 100644 index 0000000..014611f --- /dev/null +++ b/modules/app-cluster/aws/ecs-service/app_ecs_task_role.tpl @@ -0,0 +1,13 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] +} \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-service/ecs_autoscale_role.tpl b/modules/app-cluster/aws/ecs-service/ecs_autoscale_role.tpl new file mode 100644 index 0000000..3acddba --- /dev/null +++ b/modules/app-cluster/aws/ecs-service/ecs_autoscale_role.tpl @@ -0,0 +1,14 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": [ + "application-autoscaling.amazonaws.com" + ] + }, + "Effect": "Allow" + } + ] +} \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-service/ecs_role.tpl b/modules/app-cluster/aws/ecs-service/ecs_role.tpl new file mode 100644 index 0000000..a662b99 --- /dev/null +++ b/modules/app-cluster/aws/ecs-service/ecs_role.tpl @@ -0,0 +1,15 @@ +{ + "Version": "2008-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": [ + "ecs.amazonaws.com", + "ec2.amazonaws.com" + ] + }, + "Effect": "Allow" + } + ] +} \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-service/logs-policy.tpl b/modules/app-cluster/aws/ecs-service/logs-policy.tpl new file mode 100644 index 0000000..99776bc --- /dev/null +++ b/modules/app-cluster/aws/ecs-service/logs-policy.tpl @@ -0,0 +1,15 @@ +{ + "Id": "${var.project_name}-${terraform.workspace}-logs-policy", + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Stmt1484671540333", + "Action": "s3:PutObject", + "Effect": "Allow", + "Resource": "arn:aws:s3:::${var.project_name}-${terraform.workspace}-logs/*", + "Principal": { + "AWS": "arn:aws:iam::${lookup(var.default_log_account_ids, var.aws_region)}:root" + } + } + ] +} \ No newline at end of file diff --git a/modules/app-cluster/aws/ecs-service/main.tf b/modules/app-cluster/aws/ecs-service/main.tf index e69de29..ed9f28b 100644 --- a/modules/app-cluster/aws/ecs-service/main.tf +++ b/modules/app-cluster/aws/ecs-service/main.tf @@ -0,0 +1,395 @@ +#---------------------------------------- +# BrightFame APP-CLUSTER Terraform module +# +# version: x.x.x +# +# License: +# +#---------------------------------------- + +# AWS provider definition +provider "aws" { + region = "${var.aws_region}" + version = "${var.aws_provider_version}" +} + +# //resource - aws_ecs_cluster + +# //resource - aws_ecs_task_definition + +# //resource - aws_ecs_service + +# //resource - aws_appautoscaling_target + +# //resource - aws_cloudwatch_log_group + +# //resource - aws_alb + +# //resource - aws_alb_listener + +# //resource - aws_alb_target_group + +# //resource - aws_autoscaling_group + +# //resource - aws_launch_configuration + +# //resource - aws_security_group + +# //resource - aws_iam_role + +# //resource - aws_iam_role_policy_attachment + +# //data - aws_ecs_task_definition + +# //data - template_app_ecs_user_data + +##################################################################################################################################### +# +# Resources to be migrated to dynamic +# +# ---= Below is the code that we should migrate =--- +# +##################################################################################################################################### + +# resource "aws_ecs_cluster" "cluster_app" { +# name = "${terraform.workspace}-app" + +# lifecycle { +# create_before_destroy = true +# } +# } + +# data "aws_ecs_task_definition" "magento2" { +# task_definition = "${aws_ecs_task_definition.magento2.family}" + +# depends_on = [ +# "aws_ecs_task_definition.magento2", +# ] +# } + +# /* Initial task definition - will be updated later by the deploy script */ +# resource "aws_ecs_task_definition" "magento2" { +# family = "${terraform.workspace}-magento2" + +# container_definitions = < + + + + + +%3 + + + +[root] aws_alb.app + +aws_alb.app + + + +[root] aws_s3_bucket.logs + +aws_s3_bucket.logs + + + +[root] aws_alb.app->[root] aws_s3_bucket.logs + + + + + +[root] aws_security_group.alb_web + +aws_security_group.alb_web + + + +[root] aws_alb.app->[root] aws_security_group.alb_web + + + + + +[root] aws_subnet.public_az1 + +aws_subnet.public_az1 + + + +[root] aws_alb.app->[root] aws_subnet.public_az1 + + + + + +[root] aws_subnet.public_az2 + +aws_subnet.public_az2 + + + +[root] aws_alb.app->[root] aws_subnet.public_az2 + + + + + +[root] aws_subnet.public_az3 + +aws_subnet.public_az3 + + + +[root] aws_alb.app->[root] aws_subnet.public_az3 + + + + + +[root] aws_alb_listener.app_http + +aws_alb_listener.app_http + + + +[root] aws_alb_listener.app_http->[root] aws_alb.app + + + + + +[root] aws_alb_target_group.app + +aws_alb_target_group.app + + + +[root] aws_alb_listener.app_http->[root] aws_alb_target_group.app + + + + + +[root] aws_vpc.default + +aws_vpc.default + + + +[root] aws_alb_target_group.app->[root] aws_vpc.default + + + + + +[root] aws_appautoscaling_target.service_appalb_asg_target + +aws_appautoscaling_target.service_appalb_asg_target + + + +[root] aws_ecs_service.magento2 + +aws_ecs_service.magento2 + + + +[root] aws_appautoscaling_target.service_appalb_asg_target->[root] aws_ecs_service.magento2 + + + + + +[root] aws_iam_role.ecs_autoscale_role + +aws_iam_role.ecs_autoscale_role + + + +[root] aws_appautoscaling_target.service_appalb_asg_target->[root] aws_iam_role.ecs_autoscale_role + + + + + +[root] aws_autoscaling_group.asg_app + +aws_autoscaling_group.asg_app + + + +[root] aws_autoscaling_group.asg_app->[root] aws_alb_target_group.app + + + + + +[root] aws_launch_configuration.lc_app + +aws_launch_configuration.lc_app + + + +[root] aws_autoscaling_group.asg_app->[root] aws_launch_configuration.lc_app + + + + + +[root] var.app_server_count + +[root] var.app_server_count + + + +[root] aws_autoscaling_group.asg_app->[root] var.app_server_count + + + + + +[root] var.availability_zones + +[root] var.availability_zones + + + +[root] aws_autoscaling_group.asg_app->[root] var.availability_zones + + + + + +[root] aws_cloudwatch_event_rule.cron_schedule + +aws_cloudwatch_event_rule.cron_schedule + + + +[root] provider.aws + +provider.aws + + + +[root] aws_cloudwatch_event_rule.cron_schedule->[root] provider.aws + + + + + +[root] aws_cloudwatch_event_target.magento_cron + +aws_cloudwatch_event_target.magento_cron + + + +[root] aws_cloudwatch_event_target.magento_cron->[root] aws_cloudwatch_event_rule.cron_schedule + + + + + +[root] aws_ecs_cluster.cluster_app + +aws_ecs_cluster.cluster_app + + + +[root] aws_cloudwatch_event_target.magento_cron->[root] aws_ecs_cluster.cluster_app + + + + + +[root] aws_ecs_task_definition.magento2_cron + +aws_ecs_task_definition.magento2_cron + + + +[root] aws_cloudwatch_event_target.magento_cron->[root] aws_ecs_task_definition.magento2_cron + + + + + +[root] aws_iam_role.task_role + +aws_iam_role.task_role + + + +[root] aws_cloudwatch_event_target.magento_cron->[root] aws_iam_role.task_role + + + + + +[root] aws_cloudwatch_log_group.app + +aws_cloudwatch_log_group.app + + + +[root] aws_cloudwatch_log_group.app->[root] provider.aws + + + + + +[root] aws_db_subnet_group.default + +aws_db_subnet_group.default + + + +[root] aws_subnet.private_az1 + +aws_subnet.private_az1 + + + +[root] aws_db_subnet_group.default->[root] aws_subnet.private_az1 + + + + + +[root] aws_subnet.private_az2 + +aws_subnet.private_az2 + + + +[root] aws_db_subnet_group.default->[root] aws_subnet.private_az2 + + + + + +[root] aws_subnet.private_az3 + +aws_subnet.private_az3 + + + +[root] aws_db_subnet_group.default->[root] aws_subnet.private_az3 + + + + + +[root] aws_ecs_cluster.cluster_app->[root] provider.aws + + + + + +[root] aws_ecs_service.magento2->[root] aws_alb_listener.app_http + + + + + +[root] aws_ecs_service.magento2->[root] aws_ecs_cluster.cluster_app + + + + + +[root] aws_iam_role.app_ecs_service_role + +aws_iam_role.app_ecs_service_role + + + +[root] aws_ecs_service.magento2->[root] aws_iam_role.app_ecs_service_role + + + + + +[root] data.aws_ecs_task_definition.magento2 + +data.aws_ecs_task_definition.magento2 + + + +[root] aws_ecs_service.magento2->[root] data.aws_ecs_task_definition.magento2 + + + + + +[root] var.app_task_count + +[root] var.app_task_count + + + +[root] aws_ecs_service.magento2->[root] var.app_task_count + + + + + +[root] aws_ecs_task_definition.magento2 + +aws_ecs_task_definition.magento2 + + + +[root] aws_route53_record.db + +aws_route53_record.db + + + +[root] aws_ecs_task_definition.magento2->[root] aws_route53_record.db + + + + + +[root] aws_route53_record.redis_cache + +aws_route53_record.redis_cache + + + +[root] aws_ecs_task_definition.magento2->[root] aws_route53_record.redis_cache + + + + + +[root] aws_route53_record.redis_session + +aws_route53_record.redis_session + + + +[root] aws_ecs_task_definition.magento2->[root] aws_route53_record.redis_session + + + + + +[root] data.aws_ecr_repository.magento2 + +data.aws_ecr_repository.magento2 + + + +[root] aws_ecs_task_definition.magento2->[root] data.aws_ecr_repository.magento2 + + + + + +[root] data.aws_ecr_repository.nginx + +data.aws_ecr_repository.nginx + + + +[root] aws_ecs_task_definition.magento2->[root] data.aws_ecr_repository.nginx + + + + + +[root] var.env_mysql_database + +[root] var.env_mysql_database + + + +[root] aws_ecs_task_definition.magento2->[root] var.env_mysql_database + + + + + +[root] var.env_mysql_user + +[root] var.env_mysql_user + + + +[root] aws_ecs_task_definition.magento2->[root] var.env_mysql_user + + + + + +[root] aws_ecs_task_definition.magento2_cron->[root] aws_route53_record.db + + + + + +[root] aws_ecs_task_definition.magento2_cron->[root] aws_route53_record.redis_cache + + + + + +[root] aws_ecs_task_definition.magento2_cron->[root] aws_route53_record.redis_session + + + + + +[root] aws_ecs_task_definition.magento2_cron->[root] data.aws_ecr_repository.magento2 + + + + + +[root] aws_ecs_task_definition.magento2_cron->[root] var.env_mysql_database + + + + + +[root] aws_ecs_task_definition.magento2_cron->[root] var.env_mysql_user + + + + + +[root] aws_ecs_task_definition.magento2_setup + +aws_ecs_task_definition.magento2_setup + + + +[root] aws_ecs_task_definition.magento2_setup->[root] aws_alb.app + + + + + +[root] aws_ecs_task_definition.magento2_setup->[root] aws_route53_record.db + + + + + +[root] aws_ecs_task_definition.magento2_setup->[root] aws_route53_record.redis_cache + + + + + +[root] aws_ecs_task_definition.magento2_setup->[root] aws_route53_record.redis_session + + + + + +[root] aws_ecs_task_definition.magento2_setup->[root] data.aws_ecr_repository.magento2 + + + + + +[root] aws_ecs_task_definition.magento2_setup->[root] var.env_mysql_database + + + + + +[root] aws_ecs_task_definition.magento2_setup->[root] var.env_mysql_user + + + + + +[root] aws_efs_file_system.media + +aws_efs_file_system.media + + + +[root] aws_efs_file_system.media->[root] provider.aws + + + + + +[root] var.project_name + +[root] var.project_name + + + +[root] aws_efs_file_system.media->[root] var.project_name + + + + + +[root] aws_efs_mount_target.az1 + +aws_efs_mount_target.az1 + + + +[root] aws_efs_mount_target.az1->[root] aws_efs_file_system.media + + + + + +[root] aws_security_group.efs + +aws_security_group.efs + + + +[root] aws_efs_mount_target.az1->[root] aws_security_group.efs + + + + + +[root] aws_efs_mount_target.az1->[root] aws_subnet.private_az1 + + + + + +[root] aws_efs_mount_target.az2 + +aws_efs_mount_target.az2 + + + +[root] aws_efs_mount_target.az2->[root] aws_efs_file_system.media + + + + + +[root] aws_efs_mount_target.az2->[root] aws_security_group.efs + + + + + +[root] aws_efs_mount_target.az2->[root] aws_subnet.private_az2 + + + + + +[root] aws_efs_mount_target.az3 + +aws_efs_mount_target.az3 + + + +[root] aws_efs_mount_target.az3->[root] aws_efs_file_system.media + + + + + +[root] aws_efs_mount_target.az3->[root] aws_security_group.efs + + + + + +[root] aws_efs_mount_target.az3->[root] aws_subnet.private_az3 + + + + + +[root] aws_egress_only_internet_gateway.ipv6egress + +aws_egress_only_internet_gateway.ipv6egress + + + +[root] aws_egress_only_internet_gateway.ipv6egress->[root] aws_vpc.default + + + + + +[root] aws_eip.bastion + +aws_eip.bastion + + + +[root] aws_instance.bastion + +aws_instance.bastion + + + +[root] aws_eip.bastion->[root] aws_instance.bastion + + + + + +[root] aws_eip.nat + +aws_eip.nat + + + +[root] aws_eip.nat->[root] provider.aws + + + + + +[root] aws_elasticache_cluster.redis_cache + +aws_elasticache_cluster.redis_cache + + + +[root] aws_elasticache_subnet_group.redis + +aws_elasticache_subnet_group.redis + + + +[root] aws_elasticache_cluster.redis_cache->[root] aws_elasticache_subnet_group.redis + + + + + +[root] aws_security_group.default + +aws_security_group.default + + + +[root] aws_elasticache_cluster.redis_cache->[root] aws_security_group.default + + + + + +[root] aws_security_group.redis + +aws_security_group.redis + + + +[root] aws_elasticache_cluster.redis_cache->[root] aws_security_group.redis + + + + + +[root] aws_elasticache_cluster.redis_session + +aws_elasticache_cluster.redis_session + + + +[root] aws_elasticache_cluster.redis_session->[root] aws_elasticache_subnet_group.redis + + + + + +[root] aws_elasticache_cluster.redis_session->[root] aws_security_group.default + + + + + +[root] aws_elasticache_cluster.redis_session->[root] aws_security_group.redis + + + + + +[root] aws_elasticache_subnet_group.redis->[root] aws_subnet.private_az1 + + + + + +[root] aws_elasticache_subnet_group.redis->[root] aws_subnet.private_az2 + + + + + +[root] aws_elasticache_subnet_group.redis->[root] aws_subnet.private_az3 + + + + + +[root] aws_iam_instance_profile.ecs_app_instance_profile + +aws_iam_instance_profile.ecs_app_instance_profile + + + +[root] aws_iam_role.ecs_role + +aws_iam_role.ecs_role + + + +[root] aws_iam_instance_profile.ecs_app_instance_profile->[root] aws_iam_role.ecs_role + + + + + +[root] aws_iam_role.app_ecs_service_role->[root] provider.aws + + + + + +[root] aws_iam_role.app_ecs_task_role + +aws_iam_role.app_ecs_task_role + + + +[root] aws_iam_role.app_ecs_task_role->[root] provider.aws + + + + + +[root] aws_iam_role.ecs_autoscale_role->[root] provider.aws + + + + + +[root] aws_iam_role.ecs_role->[root] provider.aws + + + + + +[root] aws_iam_role.task_role->[root] provider.aws + + + + + +[root] aws_iam_role_policy.run_task_policy + +aws_iam_role_policy.run_task_policy + + + +[root] aws_iam_role_policy.run_task_policy->[root] aws_iam_role.task_role + + + + + +[root] aws_iam_role_policy_attachment.ecs_autoscale_role_policy_attachment + +aws_iam_role_policy_attachment.ecs_autoscale_role_policy_attachment + + + +[root] aws_iam_role_policy_attachment.ecs_autoscale_role_policy_attachment->[root] aws_iam_role.ecs_autoscale_role + + + + + +[root] aws_iam_role_policy_attachment.ecs_instance_instance_role_policy_attachment + +aws_iam_role_policy_attachment.ecs_instance_instance_role_policy_attachment + + + +[root] aws_iam_role_policy_attachment.ecs_instance_instance_role_policy_attachment->[root] aws_iam_role.ecs_role + + + + + +[root] aws_iam_role_policy_attachment.ecs_service_instance_role_policy_attachment + +aws_iam_role_policy_attachment.ecs_service_instance_role_policy_attachment + + + +[root] aws_iam_role_policy_attachment.ecs_service_instance_role_policy_attachment->[root] aws_iam_role.ecs_role + + + + + +[root] aws_iam_role_policy_attachment.ecs_service_role_policy_attachment + +aws_iam_role_policy_attachment.ecs_service_role_policy_attachment + + + +[root] aws_iam_role_policy_attachment.ecs_service_role_policy_attachment->[root] aws_iam_role.app_ecs_service_role + + + + + +[root] aws_key_pair.deployer + +aws_key_pair.deployer + + + +[root] aws_instance.bastion->[root] aws_key_pair.deployer + + + + + +[root] aws_security_group.bastion + +aws_security_group.bastion + + + +[root] aws_instance.bastion->[root] aws_security_group.bastion + + + + + +[root] aws_instance.bastion->[root] aws_subnet.public_az1 + + + + + +[root] var.amazon_dns_server + +[root] var.amazon_dns_server + + + +[root] aws_instance.bastion->[root] var.amazon_dns_server + + + + + +[root] var.amis + +[root] var.amis + + + +[root] aws_instance.bastion->[root] var.amis + + + + + +[root] aws_internet_gateway.default + +aws_internet_gateway.default + + + +[root] aws_internet_gateway.default->[root] aws_vpc.default + + + + + +[root] aws_key_pair.deployer->[root] provider.aws + + + + + +[root] aws_launch_configuration.lc_app->[root] aws_iam_instance_profile.ecs_app_instance_profile + + + + + +[root] data.template_file.template_app_ecs_user_data + +data.template_file.template_app_ecs_user_data + + + +[root] aws_launch_configuration.lc_app->[root] data.template_file.template_app_ecs_user_data + + + + + +[root] var.ecs_ami + +[root] var.ecs_ami + + + +[root] aws_launch_configuration.lc_app->[root] var.ecs_ami + + + + + +[root] aws_nat_gateway.nat + +aws_nat_gateway.nat + + + +[root] aws_nat_gateway.nat->[root] aws_eip.nat + + + + + +[root] aws_nat_gateway.nat->[root] aws_subnet.public_az1 + + + + + +[root] aws_nat_gateway.nat->[root] aws_subnet.public_az2 + + + + + +[root] aws_nat_gateway.nat->[root] aws_subnet.public_az3 + + + + + +[root] aws_rds_cluster.default + +aws_rds_cluster.default + + + +[root] aws_rds_cluster.default->[root] aws_db_subnet_group.default + + + + + +[root] aws_rds_cluster.default->[root] aws_security_group.default + + + + + +[root] aws_security_group.rds + +aws_security_group.rds + + + +[root] aws_rds_cluster.default->[root] aws_security_group.rds + + + + + +[root] var.rds_password + +[root] var.rds_password + + + +[root] aws_rds_cluster.default->[root] var.rds_password + + + + + +[root] aws_rds_cluster_instance.cluster_instances + +aws_rds_cluster_instance.cluster_instances + + + +[root] aws_rds_cluster_instance.cluster_instances->[root] aws_rds_cluster.default + + + + + +[root] aws_route53_record.db->[root] aws_rds_cluster.default + + + + + +[root] aws_route53_zone.internal + +aws_route53_zone.internal + + + +[root] aws_route53_record.db->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.efs_az1 + +aws_route53_record.efs_az1 + + + +[root] aws_route53_record.efs_az1->[root] aws_efs_file_system.media + + + + + +[root] aws_route53_record.efs_az1->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.efs_az2 + +aws_route53_record.efs_az2 + + + +[root] aws_route53_record.efs_az2->[root] aws_efs_file_system.media + + + + + +[root] aws_route53_record.efs_az2->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.efs_az3 + +aws_route53_record.efs_az3 + + + +[root] aws_route53_record.efs_az3->[root] aws_efs_file_system.media + + + + + +[root] aws_route53_record.efs_az3->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.efs_dns + +aws_route53_record.efs_dns + + + +[root] aws_route53_record.efs_dns->[root] aws_efs_file_system.media + + + + + +[root] aws_route53_record.efs_dns->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.internal_ns + +aws_route53_record.internal_ns + + + +[root] aws_route53_record.internal_ns->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.redis_cache->[root] aws_elasticache_cluster.redis_cache + + + + + +[root] aws_route53_record.redis_cache->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_record.redis_session->[root] aws_elasticache_cluster.redis_session + + + + + +[root] aws_route53_record.redis_session->[root] aws_route53_zone.internal + + + + + +[root] aws_route53_zone.internal->[root] aws_vpc.default + + + + + +[root] var.internal_domain + +[root] var.internal_domain + + + +[root] aws_route53_zone.internal->[root] var.internal_domain + + + + + +[root] aws_route_table.private + +aws_route_table.private + + + +[root] aws_route_table.private->[root] aws_egress_only_internet_gateway.ipv6egress + + + + + +[root] aws_route_table.private->[root] aws_nat_gateway.nat + + + + + +[root] aws_route_table.public + +aws_route_table.public + + + +[root] aws_route_table.public->[root] aws_internet_gateway.default + + + + + +[root] aws_route_table_association.private + +aws_route_table_association.private + + + +[root] aws_route_table_association.private->[root] aws_route_table.private + + + + + +[root] aws_route_table_association.private->[root] aws_subnet.private_az1 + + + + + +[root] aws_route_table_association.private->[root] aws_subnet.private_az2 + + + + + +[root] aws_route_table_association.private->[root] aws_subnet.private_az3 + + + + + +[root] aws_route_table_association.public_az1 + +aws_route_table_association.public_az1 + + + +[root] aws_route_table_association.public_az1->[root] aws_route_table.public + + + + + +[root] aws_route_table_association.public_az1->[root] aws_subnet.public_az1 + + + + + +[root] aws_route_table_association.public_az2 + +aws_route_table_association.public_az2 + + + +[root] aws_route_table_association.public_az2->[root] aws_route_table.public + + + + + +[root] aws_route_table_association.public_az2->[root] aws_subnet.public_az2 + + + + + +[root] aws_route_table_association.public_az3 + +aws_route_table_association.public_az3 + + + +[root] aws_route_table_association.public_az3->[root] aws_route_table.public + + + + + +[root] aws_route_table_association.public_az3->[root] aws_subnet.public_az3 + + + + + +[root] aws_s3_bucket.logs->[root] provider.aws + + + + + +[root] aws_s3_bucket.logs->[root] var.project_name + + + + + +[root] var.default_log_account_ids + +[root] var.default_log_account_ids + + + +[root] aws_s3_bucket.logs->[root] var.default_log_account_ids + + + + + +[root] aws_security_group.alb_web->[root] aws_vpc.default + + + + + +[root] aws_security_group.app + +aws_security_group.app + + + +[root] aws_security_group.app->[root] aws_security_group.bastion + + + + + +[root] aws_security_group.bastion->[root] aws_vpc.default + + + + + +[root] aws_security_group.default->[root] aws_vpc.default + + + + + +[root] aws_security_group.efs->[root] aws_security_group.app + + + + + +[root] aws_security_group.rds->[root] aws_security_group.app + + + + + +[root] aws_security_group.redis->[root] aws_security_group.app + + + + + +[root] aws_subnet.private_az1->[root] aws_internet_gateway.default + + + + + +[root] var.private_subnet_az1_cidr + +[root] var.private_subnet_az1_cidr + + + +[root] aws_subnet.private_az1->[root] var.private_subnet_az1_cidr + + + + + +[root] aws_subnet.private_az2->[root] aws_internet_gateway.default + + + + + +[root] var.private_subnet_az2_cidr + +[root] var.private_subnet_az2_cidr + + + +[root] aws_subnet.private_az2->[root] var.private_subnet_az2_cidr + + + + + +[root] aws_subnet.private_az3->[root] aws_internet_gateway.default + + + + + +[root] var.private_subnet_az3_cidr + +[root] var.private_subnet_az3_cidr + + + +[root] aws_subnet.private_az3->[root] var.private_subnet_az3_cidr + + + + + +[root] aws_subnet.public_az1->[root] aws_internet_gateway.default + + + + + +[root] var.public_subnet_az1_cidr + +[root] var.public_subnet_az1_cidr + + + +[root] aws_subnet.public_az1->[root] var.public_subnet_az1_cidr + + + + + +[root] aws_subnet.public_az2->[root] aws_internet_gateway.default + + + + + +[root] var.public_subnet_az2_cidr + +[root] var.public_subnet_az2_cidr + + + +[root] aws_subnet.public_az2->[root] var.public_subnet_az2_cidr + + + + + +[root] aws_subnet.public_az3->[root] aws_internet_gateway.default + + + + + +[root] var.public_subnet_az3_cidr + +[root] var.public_subnet_az3_cidr + + + +[root] aws_subnet.public_az3->[root] var.public_subnet_az3_cidr + + + + + +[root] aws_vpc.default->[root] provider.aws + + + + + +[root] aws_vpc.default->[root] var.project_name + + + + + +[root] var.vpc_cidr + +[root] var.vpc_cidr + + + +[root] aws_vpc.default->[root] var.vpc_cidr + + + + + +[root] data.aws_ecr_repository.magento2->[root] provider.aws + + + + + +[root] data.aws_ecr_repository.nginx->[root] provider.aws + + + + + +[root] data.aws_ecs_task_definition.magento2->[root] aws_ecs_task_definition.magento2 + + + + + +[root] data.template_file.template_app_ecs_user_data->[root] aws_route53_record.db + + + + + +[root] provider.template + +provider.template + + + +[root] data.template_file.template_app_ecs_user_data->[root] provider.template + + + + + +[root] data.template_file.template_app_ecs_user_data->[root] var.env_mysql_database + + + + + +[root] data.template_file.template_app_ecs_user_data->[root] var.env_mysql_user + + + + + +[root] var.aws_region + +[root] var.aws_region + + + +[root] provider.aws->[root] var.aws_region + + + + + +[root] meta.count-boundary (count boundary fixup) + +[root] meta.count-boundary (count boundary fixup) + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_appautoscaling_target.service_appalb_asg_target + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_autoscaling_group.asg_app + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_cloudwatch_event_target.magento_cron + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_cloudwatch_log_group.app + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_ecs_task_definition.magento2_setup + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_efs_mount_target.az1 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_efs_mount_target.az2 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_efs_mount_target.az3 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_iam_role.app_ecs_task_role + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_iam_role_policy.run_task_policy + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_iam_role_policy_attachment.ecs_autoscale_role_policy_attachment + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_iam_role_policy_attachment.ecs_instance_instance_role_policy_attachment + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_iam_role_policy_attachment.ecs_service_instance_role_policy_attachment + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_iam_role_policy_attachment.ecs_service_role_policy_attachment + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_rds_cluster_instance.cluster_instances + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route53_record.efs_az1 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route53_record.efs_az2 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route53_record.efs_az3 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route53_record.efs_dns + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route53_record.internal_ns + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route_table_association.private + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route_table_association.public_az1 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route_table_association.public_az2 + + + + + +[root] meta.count-boundary (count boundary fixup)->[root] aws_route_table_association.public_az3 + + + + + +[root] output.alb_name + +[root] output.alb_name + + + +[root] meta.count-boundary (count boundary fixup)->[root] output.alb_name + + + + + +[root] output.bastion.ip + +[root] output.bastion.ip + + + +[root] meta.count-boundary (count boundary fixup)->[root] output.bastion.ip + + + + + +[root] var.ssh_user + +[root] var.ssh_user + + + +[root] meta.count-boundary (count boundary fixup)->[root] var.ssh_user + + + + + +[root] output.alb_name->[root] aws_alb.app + + + + + +[root] output.bastion.ip->[root] aws_eip.bastion + + + + + +[root] provider.aws (close) + +[root] provider.aws (close) + + + +[root] provider.aws (close)->[root] aws_appautoscaling_target.service_appalb_asg_target + + + + + +[root] provider.aws (close)->[root] aws_autoscaling_group.asg_app + + + + + +[root] provider.aws (close)->[root] aws_cloudwatch_event_target.magento_cron + + + + + +[root] provider.aws (close)->[root] aws_cloudwatch_log_group.app + + + + + +[root] provider.aws (close)->[root] aws_ecs_task_definition.magento2_setup + + + + + +[root] provider.aws (close)->[root] aws_efs_mount_target.az1 + + + + + +[root] provider.aws (close)->[root] aws_efs_mount_target.az2 + + + + + +[root] provider.aws (close)->[root] aws_efs_mount_target.az3 + + + + + +[root] provider.aws (close)->[root] aws_eip.bastion + + + + + +[root] provider.aws (close)->[root] aws_iam_role.app_ecs_task_role + + + + + +[root] provider.aws (close)->[root] aws_iam_role_policy.run_task_policy + + + + + +[root] provider.aws (close)->[root] aws_iam_role_policy_attachment.ecs_autoscale_role_policy_attachment + + + + + +[root] provider.aws (close)->[root] aws_iam_role_policy_attachment.ecs_instance_instance_role_policy_attachment + + + + + +[root] provider.aws (close)->[root] aws_iam_role_policy_attachment.ecs_service_instance_role_policy_attachment + + + + + +[root] provider.aws (close)->[root] aws_iam_role_policy_attachment.ecs_service_role_policy_attachment + + + + + +[root] provider.aws (close)->[root] aws_rds_cluster_instance.cluster_instances + + + + + +[root] provider.aws (close)->[root] aws_route53_record.efs_az1 + + + + + +[root] provider.aws (close)->[root] aws_route53_record.efs_az2 + + + + + +[root] provider.aws (close)->[root] aws_route53_record.efs_az3 + + + + + +[root] provider.aws (close)->[root] aws_route53_record.efs_dns + + + + + +[root] provider.aws (close)->[root] aws_route53_record.internal_ns + + + + + +[root] provider.aws (close)->[root] aws_route_table_association.private + + + + + +[root] provider.aws (close)->[root] aws_route_table_association.public_az1 + + + + + +[root] provider.aws (close)->[root] aws_route_table_association.public_az2 + + + + + +[root] provider.aws (close)->[root] aws_route_table_association.public_az3 + + + + + +[root] provider.template (close) + +[root] provider.template (close) + + + +[root] provider.template (close)->[root] data.template_file.template_app_ecs_user_data + + + + + +[root] provisioner.file (close) + +[root] provisioner.file (close) + + + +[root] provisioner.file (close)->[root] aws_instance.bastion + + + + + +[root] provisioner.remote-exec (close) + +[root] provisioner.remote-exec (close) + + + +[root] provisioner.remote-exec (close)->[root] aws_instance.bastion + + + + + +[root] root + +[root] root + + + +[root] root->[root] meta.count-boundary (count boundary fixup) + + + + + +[root] root->[root] provider.aws (close) + + + + + +[root] root->[root] provider.template (close) + + + + + +[root] root->[root] provisioner.file (close) + + + + + +[root] root->[root] provisioner.remote-exec (close) + + + + + diff --git a/v1-legacy/terraform/terraform.tf b/v1-legacy/terraform/terraform.tf index 469d44c..e69de29 100644 --- a/v1-legacy/terraform/terraform.tf +++ b/v1-legacy/terraform/terraform.tf @@ -1,7 +0,0 @@ -terraform { - backend "s3" { - bucket = "magecloudkit-state" - key = "terraform" - region = "us-east-1" - } -}