finalized automated build for web
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
resource "aws_autoscaling_group" "es_asg" {
|
||||
resource "aws_autoscaling_group" "catherine_fc_asg" {
|
||||
name = "${var.basename}-${terraform.workspace}"
|
||||
|
||||
availability_zones = ["ap-northeast-1a", "ap-northeast-1c", "ap-northeast-1d"]
|
||||
@@ -9,7 +9,7 @@ resource "aws_autoscaling_group" "es_asg" {
|
||||
min_size = var.asg_caps.min
|
||||
|
||||
launch_configuration = aws_launch_configuration.catherine_fc_conf.name
|
||||
|
||||
target_group_arns = [aws_lb_target_group.target_group_web.id]
|
||||
tags = concat(var.asg_tags, [
|
||||
{
|
||||
key = "STAGE_ENVIRONMENT",
|
||||
|
||||
@@ -5,7 +5,7 @@ data "aws_ami" "catherine_fc_ami" {
|
||||
|
||||
filter {
|
||||
name = "name"
|
||||
values = [ "catherine-fc" ]
|
||||
values = [ "catherine-fc-*" ]
|
||||
}
|
||||
|
||||
owners = [ "353699021357" ]
|
||||
|
||||
@@ -90,8 +90,3 @@ resource "aws_iam_role_policy" "catherine_fc_s3" {
|
||||
}
|
||||
EOF5
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "GOV_ssm_basic" {
|
||||
role = aws_iam_role.instance.id
|
||||
policy_arn = "arn:aws:iam::${data.aws_caller_identity.self.account_id}:policy/GOV_ssm_basic"
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ resource "aws_launch_configuration" "catherine_fc_conf" {
|
||||
instance_type = var.ec2_instance_type
|
||||
iam_instance_profile = aws_iam_instance_profile.catherine_fc_profile.name
|
||||
security_groups = [
|
||||
aws_security_group.catherine_fc_ec2_sg.id
|
||||
aws_security_group.catherine_fc_asg_sg.id
|
||||
]
|
||||
user_data = <<-EOF
|
||||
#!/bin/bash
|
||||
|
||||
@@ -2,15 +2,15 @@ resource "aws_lb" "catherine_fc_load_balancer" {
|
||||
name = "catherine-fc-lb"
|
||||
internal = false
|
||||
load_balancer_type = "application"
|
||||
security_groups = [aws_security_group.catherine_fc_lb_sg]
|
||||
subnets = [var.internal_subnet_ids]
|
||||
security_groups = [aws_security_group.catherine_fc_lb_sg.id]
|
||||
subnets = var.internal_subnet_ids
|
||||
|
||||
enable_deletion_protection = true
|
||||
|
||||
tags = var.tags
|
||||
}
|
||||
resource "aws_lb_listener" "front_end" {
|
||||
load_balancer_arn = aws_lb.front_end.arn
|
||||
resource "aws_lb_listener" "catherine_fc_load_balancer_listener" {
|
||||
load_balancer_arn = aws_lb.catherine_fc_load_balancer.arn
|
||||
port = "443"
|
||||
protocol = "HTTPS"
|
||||
ssl_policy = "ELBSecurityPolicy-TLS-1-2-Ext-2018-06"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
output "asg_arn" {
|
||||
value = aws_autoscaling_group.es_asg.arn
|
||||
value = aws_autoscaling_group.catherine_fc_asg.arn
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
resource "aws_security_group" "catherine_fc_asg_sg" {
|
||||
name = "catherine-fc-asg-sg"
|
||||
description = "catherine fc security group"
|
||||
vpc_id = var.vpc_id
|
||||
tags = var.tags
|
||||
@@ -27,6 +28,7 @@ resource "aws_security_group_rule" "catherine_fc_asg_sg_allow_egress" {
|
||||
}
|
||||
|
||||
resource "aws_security_group" "catherine_fc_lb_sg" {
|
||||
name = "catherine-fc-alb-sg"
|
||||
description = "catherine fc security group for load balancer"
|
||||
vpc_id = var.vpc_id
|
||||
tags = var.tags
|
||||
@@ -43,7 +45,7 @@ resource "aws_security_group_rule" "catherine_fc_alb_sg_ingress" {
|
||||
security_group_id = aws_security_group.catherine_fc_lb_sg.id
|
||||
}
|
||||
|
||||
resource "aws_security_group_rule" "catherine_fc_asg_sg_allow_egress" {
|
||||
resource "aws_security_group_rule" "catherine_fc_alb_sg_allow_egress" {
|
||||
description = "allow all"
|
||||
type = "egress"
|
||||
protocol = "all"
|
||||
|
||||
@@ -2,5 +2,5 @@ resource "aws_lb_target_group" "target_group_web" {
|
||||
name = "catherine-fc-tg"
|
||||
port = 8080
|
||||
protocol = "HTTP"
|
||||
vpc_id = aws_vpc.main.id
|
||||
vpc_id = var.vpc_id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user