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

enhance local development ex #52

Merged
merged 6 commits into from
Sep 30, 2023
Merged

Conversation

ShotaroMatsuya
Copy link
Owner

No description provided.

@github-actions
Copy link

terraform/scheduling

Terraform Format and Style 🖌success

Terraform Plan 📖success

Show Plan
Acquiring state lock. This may take a few moments...
data.aws_iam_role.task_role: Reading...
module.custom_domain.data.aws_route53_zone.mydomain: Reading...
data.aws_efs_file_system.my_efs: Reading...
data.aws_iam_role.task_execution_role: Reading...
data.aws_vpc.myvpc: Reading...
data.aws_sns_topic.my_sns: Reading...
data.aws_security_group.fargate_sg: Reading...
data.aws_iam_role.task_execution_role: Read complete after 0s [id=minecraft-test-ecs_tasks_execution-role]
data.aws_iam_role.task_role: Read complete after 0s [id=ecs_tasks-minecraft-test-role]
module.custom_domain.data.aws_route53_zone.mydomain: Read complete after 1s [id=Z0885897H6FS59VX1SAQ]
data.aws_sns_topic.my_sns: Read complete after 1s [id=arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic]
data.aws_security_group.fargate_sg: Read complete after 1s [id=sg-0d23106b417fb78f6]
data.aws_efs_file_system.my_efs: Read complete after 1s [id=fs-0f00934083a3eead1]
data.aws_vpc.myvpc: Read complete after 2s [id=vpc-037fe755fc34b451a]
data.aws_subnets.my_subnets: Reading...
data.aws_subnets.my_subnets: Read complete after 0s [id=ap-northeast-1]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.custom_cloudwatch.aws_cloudwatch_log_group.firelens will be created
  + resource "aws_cloudwatch_log_group" "firelens" {
      + arn               = (known after apply)
      + id                = (known after apply)
      + name              = "/aws/ecs/minecraft-firelens-logs"
      + name_prefix       = (known after apply)
      + retention_in_days = 14
      + skip_destroy      = false
      + tags_all          = (known after apply)
    }

  # module.custom_cloudwatch.aws_cloudwatch_metric_alarm.cpu_utilization will be created
  + resource "aws_cloudwatch_metric_alarm" "cpu_utilization" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic",
        ]
      + alarm_name                            = "minecraft-test-cpu_utilization"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + datapoints_to_alarm                   = 1
      + dimensions                            = {
          + "ClusterName" = "minecraft-test-cluster"
          + "ServiceName" = "minecraft-test-service"
        }
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "CPUUtilization"
      + namespace                             = "AWS/ECS"
      + ok_actions                            = [
          + "arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic",
        ]
      + period                                = 60
      + statistic                             = "Maximum"
      + tags_all                              = (known after apply)
      + threshold                             = 90
      + treat_missing_data                    = "missing"
    }

  # module.custom_cloudwatch.aws_cloudwatch_metric_alarm.memory_utilization will be created
  + resource "aws_cloudwatch_metric_alarm" "memory_utilization" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic",
        ]
      + alarm_name                            = "minecraft-test-memory_utilization"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + datapoints_to_alarm                   = 1
      + dimensions                            = {
          + "ClusterName" = "minecraft-test-cluster"
          + "ServiceName" = "minecraft-test-service"
        }
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "MemoryUtilization"
      + namespace                             = "AWS/ECS"
      + ok_actions                            = [
          + "arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic",
        ]
      + period                                = 60
      + statistic                             = "Maximum"
      + tags_all                              = (known after apply)
      + threshold                             = 80
      + treat_missing_data                    = "missing"
    }

  # module.custom_cloudwatch.aws_cloudwatch_metric_alarm.task_running_count will be created
  + resource "aws_cloudwatch_metric_alarm" "task_running_count" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic",
        ]
      + alarm_name                            = "minecraft-test-task_running_count"
      + arn                                   = (known after apply)
      + comparison_operator                   = "LessThanThreshold"
      + datapoints_to_alarm                   = 1
      + dimensions                            = {
          + "ClusterName" = "minecraft-test-cluster"
          + "ServiceName" = "minecraft-test-service"
        }
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "RunningTaskCount"
      + namespace                             = "ECS/ContainerInsights"
      + ok_actions                            = [
          + "arn:aws:sns:ap-northeast-1:528163014577:minecraft-test-sns-topic",
        ]
      + period                                = 60
      + statistic                             = "Sum"
      + tags_all                              = (known after apply)
      + threshold                             = 1
      + treat_missing_data                    = "missing"
    }

  # module.custom_domain.aws_route53_record.apps_dns will be created
  + resource "aws_route53_record" "apps_dns" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "minecraft.smat710.tk"
      + type            = "A"
      + zone_id         = "Z0885897H6FS59VX1SAQ"

      + alias {
          + evaluate_target_health = true
          + name                   = (known after apply)
          + zone_id                = (known after apply)
        }
    }

  # module.custom_ecs.aws_ecs_cluster.main will be created
  + resource "aws_ecs_cluster" "main" {
      + arn                = (known after apply)
      + capacity_providers = (known after apply)
      + id                 = (known after apply)
      + name               = "minecraft-test-cluster"
      + tags               = {
          + "environment" = "test"
          + "owners"      = "minecraft"
        }
      + tags_all           = {
          + "environment" = "test"
          + "owners"      = "minecraft"
        }

      + configuration {
          + execute_command_configuration {
              + logging = "DEFAULT"
            }
        }

      + setting {
          + name  = "containerInsights"
          + value = "enabled"
        }
    }

  # module.custom_ecs.aws_ecs_service.main will be created
  + resource "aws_ecs_service" "main" {
      + cluster                            = (known after apply)
      + deployment_maximum_percent         = 200
      + deployment_minimum_healthy_percent = 100
      + desired_count                      = 1
      + enable_ecs_managed_tags            = false
      + enable_execute_command             = true
      + health_check_grace_period_seconds  = 60
      + iam_role                           = (known after apply)
      + id                                 = (known after apply)
      + launch_type                        = "FARGATE"
      + name                               = "minecraft-test-service"
      + platform_version                   = "LATEST"
      + scheduling_strategy                = "REPLICA"
      + tags_all                           = (known after apply)
      + task_definition                    = "minecraft-test"
      + triggers                           = (known after apply)
      + wait_for_steady_state              = false

      + deployment_circuit_breaker {
          + enable   = true
          + rollback = true
        }

      + deployment_controller {
          + type = "ECS"
        }

      + load_balancer {
          + container_name   = "minecraft"
          + container_port   = 25565
          + target_group_arn = (known after apply)
        }

      + network_configuration {
          + assign_public_ip = true
          + security_groups  = [
              + "sg-0d23106b417fb78f6",
            ]
          + subnets          = [
              + "subnet-02bb0f287ec7e3597",
              + "subnet-067399b61c136f8eb",
            ]
        }
    }

  # module.custom_ecs.aws_ecs_task_definition.main will be created
  + resource "aws_ecs_task_definition" "main" {
      + arn                      = (known after apply)
      + arn_without_revision     = (known after apply)
      + container_definitions    = jsonencode(
            [
              + {
                  + cpu              = 0
                  + environment      = [
                      + {
                          + name  = "DIFFICULTY"
                          + value = "hard"
                        },
                      + {
                          + name  = "ENABLE_COMMAND_BLOCK"
                          + value = "true"
                        },
                      + {
                          + name  = "EULA"
                          + value = "TRUE"
                        },
                      + {
                          + name  = "HARDCORE"
                          + value = "true"
                        },
                      + {
                          + name  = "MAX_PLAYERS"
                          + value = "4"
                        },
                      + {
                          + name  = "OPS"
                          + value = "2cffa334-b882-41ba-8e83-0bb4cb0d8769"
                        },
                      + {
                          + name  = "OP_PERMISSION_LEVEL"
                          + value = "4"
                        },
                    ]
                  + essential        = true
                  + image            = "528163014577.dkr.ecr.ap-northeast-1.amazonaws.com/minecraft/server"
                  + logConfiguration = {
                      + logDriver = "awsfirelens"
                    }
                  + mountPoints      = [
                      + {
                          + containerPath = "/data/logs"
                          + sourceVolume  = "log-volume"
                        },
                    ]
                  + name             = "minecraft"
                  + portMappings     = [
                      + {
                          + containerPort = 25565
                          + hostPort      = 25565
                          + protocol      = "tcp"
                        },
                    ]
                },
              + {
                  + cpu                   = 0
                  + essential             = true
                  + firelensConfiguration = {
                      + options = {
                          + config-file-type        = "file"
                          + config-file-value       = "/fluent-bit/etc/fluent-bit_custom.conf"
                          + enable-ecs-log-metadata = "true"
                        }
                      + type    = "fluentbit"
                    }
                  + image                 = "528163014577.dkr.ecr.ap-northeast-1.amazonaws.com/minecraft/fluentbit"
                  + logConfiguration      = {
                      + logDriver = "awslogs"
                      + options   = {
                          + awslogs-group         = "/aws/ecs/minecraft-firelens-logs"
                          + awslogs-region        = "ap-northeast-1"
                          + awslogs-stream-prefix = "firelens"
                        }
                    }
                  + mountPoints           = [
                      + {
                          + containerPath = "/data/logs"
                          + sourceVolume  = "log-volume"
                        },
                    ]
                  + name                  = "firelens_log_router"
                  + user                  = "0"
                },
            ]
        )
      + cpu                      = "1024"
      + execution_role_arn       = "arn:aws:iam::528163014577:role/minecraft-test-ecs_tasks_execution-role"
      + family                   = "minecraft-test"
      + id                       = (known after apply)
      + memory                   = "2048"
      + network_mode             = "awsvpc"
      + requires_compatibilities = [
          + "FARGATE",
        ]
      + revision                 = (known after apply)
      + skip_destroy             = false
      + tags_all                 = (known after apply)
      + task_role_arn            = "arn:aws:iam::528163014577:role/ecs_tasks-minecraft-test-role"

      + volume {
          + name = "data"
        }
      + volume {
          + name = "log-volume"
        }
    }

  # module.custom_nlb.module.nlb.aws_lb.this[0] will be created
  + resource "aws_lb" "this" {
      + arn                              = (known after apply)
      + arn_suffix                       = (known after apply)
      + dns_name                         = (known after apply)
      + enable_cross_zone_load_balancing = false
      + enable_deletion_protection       = false
      + id                               = (known after apply)
      + internal                         = false
      + ip_address_type                  = "ipv4"
      + load_balancer_type               = "network"
      + name                             = "minecraft-test-nlb"
      + security_groups                  = (known after apply)
      + subnets                          = [
          + "subnet-02bb0f287ec7e3597",
          + "subnet-067399b61c136f8eb",
        ]
      + tags                             = {
          + "Name"        = "minecraft-test-nlb"
          + "environment" = "test"
          + "owners"      = "minecraft"
        }
      + tags_all                         = {
          + "Name"        = "minecraft-test-nlb"
          + "environment" = "test"
          + "owners"      = "minecraft"
        }
      + vpc_id                           = (known after apply)
      + zone_id                          = (known after apply)

      + timeouts {
          + create = "10m"
          + delete = "10m"
          + update = "10m"
        }
    }

  # module.custom_nlb.module.nlb.aws_lb_listener.frontend_http_tcp[0] will be created
  + resource "aws_lb_listener" "frontend_http_tcp" {
      + arn               = (known after apply)
      + id                = (known after apply)
      + load_balancer_arn = (known after apply)
      + port              = 25565
      + protocol          = "TCP"
      + ssl_policy        = (known after apply)
      + tags              = {
          + "environment" = "test"
          + "owners"      = "minecraft"
        }
      + tags_all          = {
          + "environment" = "test"
          + "owners"      = "minecraft"
        }

      + default_action {
          + order            = (known after apply)
          + target_group_arn = (known after apply)
          + type             = "forward"
        }
    }

  # module.custom_nlb.module.nlb.aws_lb_target_group.main[0] will be created
  + resource "aws_lb_target_group" "main" {
      + arn                                = (known after apply)
      + arn_suffix                         = (known after apply)
      + connection_termination             = false
      + deregistration_delay               = "10"
      + id                                 = (known after apply)
      + ip_address_type                    = (known after apply)
      + lambda_multi_value_headers_enabled = false
      + load_balancing_algorithm_type      = (known after apply)
      + load_balancing_cross_zone_enabled  = (known after apply)
      + name                               = (known after apply)
      + port                               = 25565
      + preserve_client_ip                 = (known after apply)
      + protocol                           = "TCP"
      + protocol_version                   = (known after apply)
      + proxy_protocol_v2                  = false
      + slow_start                         = 0
      + tags                               = {
          + "Name"        = ""
          + "environment" = "test"
          + "owners"      = "minecraft"
        }
      + tags_all                           = {
          + "environment" = "test"
          + "owners"      = "minecraft"
        }
      + target_type                        = "ip"
      + vpc_id                             = "vpc-037fe755fc34b451a"

      + health_check {
          + enabled             = true
          + healthy_threshold   = 2
          + interval            = 30
          + matcher             = (known after apply)
          + path                = (known after apply)
          + port                = "traffic-port"
          + protocol            = "TCP"
          + timeout             = 20
          + unhealthy_threshold = 2
        }
    }

Plan: 11 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + vpc_cidr_block = "10.0.0.0/16"
  + vpc_id         = "vpc-037fe755fc34b451a"

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
Releasing state lock. This may take a few moments...

@ShotaroMatsuya ShotaroMatsuya merged commit 3a2b03c into main Sep 30, 2023
4 checks passed
@ShotaroMatsuya ShotaroMatsuya deleted the chore/local-development branch November 19, 2023 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant