terraform - monitoring 최신화

This commit is contained in:
dsk-minchulahn
2023-11-23 14:19:27 +09:00
parent 64d5496f58
commit 1645a5061c
3 changed files with 113 additions and 125 deletions

View File

@@ -4,7 +4,7 @@ resource "aws_security_group" "grafana-allow-security" {
vpc_id = var.VPC_ID vpc_id = var.VPC_ID
ingress { ingress {
description = "SSH" description = "Allow SSH traffic"
from_port = 22 from_port = 22
to_port = 22 to_port = 22
protocol = "tcp" protocol = "tcp"
@@ -12,52 +12,52 @@ resource "aws_security_group" "grafana-allow-security" {
} }
ingress { ingress {
description = "TLS from grafana" description = "Allow HTTP traffic"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"]
}
ingress {
description = "Allow TLS traffic"
from_port = 443 from_port = 443
to_port = 443 to_port = 443
protocol = "tcp" protocol = "tcp"
cidr_blocks = ["118.223.123.161/32"] cidr_blocks = ["118.223.123.161/32"]
} }
ingress { # ingress {
description = "" # description = ""
from_port = 443 # from_port = 443
to_port = 443 # to_port = 443
protocol = "tcp" # protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"] # cidr_blocks = ["0.0.0.0/0"]
} # }
ingress { # ingress {
description = "" # description = "TLS from teleport"
from_port = 80 # from_port = 30168
to_port = 80 # to_port = 30168
protocol = "tcp" # protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"] # cidr_blocks = ["0.0.0.0/0"]
} # }
ingress { # ingress {
description = "TLS from teleport" # description = ""
from_port = 30168 # from_port = 32084
to_port = 30168 # to_port = 32084
protocol = "tcp" # protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"] # cidr_blocks = ["172.0.0.0/8"]
} # }
ingress { # ingress {
description = "" # description = "loki"
from_port = 32084 # from_port = 31768
to_port = 32084 # to_port = 31768
protocol = "tcp" # protocol = "tcp"
cidr_blocks = ["172.0.0.0/8"] # cidr_blocks = ["172.24.0.0/16"]
} # }
ingress {
description = "loki"
from_port = 31768
to_port = 31768
protocol = "tcp"
cidr_blocks = ["172.24.0.0/16"]
}
ingress { ingress {
description = "" description = ""

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.5.7", "terraform_version": "1.5.7",
"serial": 8, "serial": 16,
"lineage": "816258a5-69eb-6967-f105-8709f7e2588d", "lineage": "816258a5-69eb-6967-f105-8709f7e2588d",
"outputs": {}, "outputs": {},
"resources": [ "resources": [
@@ -173,22 +173,9 @@
"ingress": [ "ingress": [
{ {
"cidr_blocks": [ "cidr_blocks": [
"0.0.0.0/0" "118.223.123.161/32"
], ],
"description": "", "description": "Allow HTTP traffic",
"from_port": 443,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 443
},
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 80, "from_port": 80,
"ipv6_cidr_blocks": [], "ipv6_cidr_blocks": [],
"prefix_list_ids": [], "prefix_list_ids": [],
@@ -197,24 +184,11 @@
"self": false, "self": false,
"to_port": 80 "to_port": 80
}, },
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "TLS from teleport",
"from_port": 30168,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 30168
},
{ {
"cidr_blocks": [ "cidr_blocks": [
"118.223.123.161/32" "118.223.123.161/32"
], ],
"description": "SSH", "description": "Allow SSH traffic",
"from_port": 22, "from_port": 22,
"ipv6_cidr_blocks": [], "ipv6_cidr_blocks": [],
"prefix_list_ids": [], "prefix_list_ids": [],
@@ -227,7 +201,7 @@
"cidr_blocks": [ "cidr_blocks": [
"118.223.123.161/32" "118.223.123.161/32"
], ],
"description": "TLS from grafana", "description": "Allow TLS traffic",
"from_port": 443, "from_port": 443,
"ipv6_cidr_blocks": [], "ipv6_cidr_blocks": [],
"prefix_list_ids": [], "prefix_list_ids": [],
@@ -236,32 +210,6 @@
"self": false, "self": false,
"to_port": 443 "to_port": 443
}, },
{
"cidr_blocks": [
"172.0.0.0/8"
],
"description": "",
"from_port": 32084,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 32084
},
{
"cidr_blocks": [
"172.24.0.0/16"
],
"description": "loki",
"from_port": 31768,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 31768
},
{ {
"cidr_blocks": [ "cidr_blocks": [
"172.31.0.0/16" "172.31.0.0/16"

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.5.7", "terraform_version": "1.5.7",
"serial": 6, "serial": 14,
"lineage": "816258a5-69eb-6967-f105-8709f7e2588d", "lineage": "816258a5-69eb-6967-f105-8709f7e2588d",
"outputs": {}, "outputs": {},
"resources": [ "resources": [
@@ -16,7 +16,7 @@
"attributes": { "attributes": {
"ami": "ami-0409b7ddbc59e3222", "ami": "ami-0409b7ddbc59e3222",
"arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-08af287265bd05022", "arn": "arn:aws:ec2:ap-northeast-2:508259851457:instance/i-08af287265bd05022",
"associate_public_ip_address": false, "associate_public_ip_address": true,
"availability_zone": "ap-northeast-2c", "availability_zone": "ap-northeast-2c",
"capacity_reservation_specification": [ "capacity_reservation_specification": [
{ {
@@ -32,9 +32,23 @@
} }
], ],
"disable_api_stop": false, "disable_api_stop": false,
"disable_api_termination": false, "disable_api_termination": true,
"ebs_block_device": [], "ebs_block_device": [
"ebs_optimized": false, {
"delete_on_termination": false,
"device_name": "/dev/sdf",
"encrypted": false,
"iops": 600,
"kms_key_id": "",
"snapshot_id": "",
"tags": {},
"throughput": 0,
"volume_id": "vol-0a2e83f6a2d3d12b3",
"volume_size": 200,
"volume_type": "gp2"
}
],
"ebs_optimized": true,
"enclave_options": [ "enclave_options": [
{ {
"enabled": false "enabled": false
@@ -45,11 +59,11 @@
"hibernation": false, "hibernation": false,
"host_id": "", "host_id": "",
"host_resource_group_arn": null, "host_resource_group_arn": null,
"iam_instance_profile": "", "iam_instance_profile": "AmazonSSMRoleForInstancesQuickSetup",
"id": "i-08af287265bd05022", "id": "i-08af287265bd05022",
"instance_initiated_shutdown_behavior": "stop", "instance_initiated_shutdown_behavior": "stop",
"instance_state": "running", "instance_state": "running",
"instance_type": "t3.small", "instance_type": "m5.large",
"ipv6_address_count": 0, "ipv6_address_count": 0,
"ipv6_addresses": [], "ipv6_addresses": [],
"key_name": "kp-jay-bastion-datasaker", "key_name": "kp-jay-bastion-datasaker",
@@ -63,7 +77,7 @@
{ {
"http_endpoint": "enabled", "http_endpoint": "enabled",
"http_put_response_hop_limit": 1, "http_put_response_hop_limit": 1,
"http_tokens": "optional", "http_tokens": "required",
"instance_metadata_tags": "disabled" "instance_metadata_tags": "disabled"
} }
], ],
@@ -83,8 +97,8 @@
} }
], ],
"private_ip": "172.24.2.212", "private_ip": "172.24.2.212",
"public_dns": "", "public_dns": "ec2-3-38-1-96.ap-northeast-2.compute.amazonaws.com",
"public_ip": "", "public_ip": "3.38.1.96",
"root_block_device": [ "root_block_device": [
{ {
"delete_on_termination": true, "delete_on_termination": true,
@@ -92,7 +106,7 @@
"encrypted": false, "encrypted": false,
"iops": 100, "iops": 100,
"kms_key_id": "", "kms_key_id": "",
"tags": null, "tags": {},
"throughput": 0, "throughput": 0,
"volume_id": "vol-0153e1bed3b29f8b2", "volume_id": "vol-0153e1bed3b29f8b2",
"volume_size": 30, "volume_size": 30,
@@ -104,10 +118,10 @@
"source_dest_check": true, "source_dest_check": true,
"subnet_id": "subnet-0073a61bc56a68a3e", "subnet_id": "subnet-0073a61bc56a68a3e",
"tags": { "tags": {
"Name": "grafana" "Name": "monitoring.kr.datasaker.io"
}, },
"tags_all": { "tags_all": {
"Name": "grafana" "Name": "monitoring.kr.datasaker.io"
}, },
"tenancy": "default", "tenancy": "default",
"timeouts": null, "timeouts": null,
@@ -161,20 +175,7 @@
"cidr_blocks": [ "cidr_blocks": [
"118.223.123.161/32" "118.223.123.161/32"
], ],
"description": "SSH", "description": "",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "TLS from grafana",
"from_port": 443, "from_port": 443,
"ipv6_cidr_blocks": [], "ipv6_cidr_blocks": [],
"prefix_list_ids": [], "prefix_list_ids": [],
@@ -187,7 +188,7 @@
"cidr_blocks": [ "cidr_blocks": [
"118.223.123.161/32" "118.223.123.161/32"
], ],
"description": "http fron grafana", "description": "",
"from_port": 80, "from_port": 80,
"ipv6_cidr_blocks": [], "ipv6_cidr_blocks": [],
"prefix_list_ids": [], "prefix_list_ids": [],
@@ -195,6 +196,45 @@
"security_groups": [], "security_groups": [],
"self": false, "self": false,
"to_port": 80 "to_port": 80
},
{
"cidr_blocks": [
"118.223.123.161/32"
],
"description": "Allow SSH traffic",
"from_port": 22,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 22
},
{
"cidr_blocks": [
"172.31.0.0/16"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
},
{
"cidr_blocks": [],
"description": "nlb-securitygroup",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [
"sg-0c46bbbbc5ecc2786"
],
"self": false,
"to_port": 0
} }
], ],
"name": "grafana-allow-security-new", "name": "grafana-allow-security-new",
@@ -202,10 +242,10 @@
"owner_id": "508259851457", "owner_id": "508259851457",
"revoke_rules_on_delete": false, "revoke_rules_on_delete": false,
"tags": { "tags": {
"Name": "grafana-allow-security" "Name": "monitoring-allow-security"
}, },
"tags_all": { "tags_all": {
"Name": "grafana-allow-security" "Name": "monitoring-allow-security"
}, },
"timeouts": null, "timeouts": null,
"vpc_id": "vpc-00ba2b0e9ad59f0ed" "vpc_id": "vpc-00ba2b0e9ad59f0ed"