test
This commit is contained in:
60
aws_instance/terraform_grafana_230430/ec2.tf
Normal file
60
aws_instance/terraform_grafana_230430/ec2.tf
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
resource "aws_security_group" "grafana-allow-security" {
|
||||||
|
name = "grafana-allow-security"
|
||||||
|
description = "Allow inbound traffic"
|
||||||
|
vpc_id = var.VPC_ID
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
description = "SSH"
|
||||||
|
from_port = 22
|
||||||
|
to_port = 22
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["118.223.123.161/32","175.124.220.188/32"]
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
description = "TLS from grafana"
|
||||||
|
from_port = 443
|
||||||
|
to_port = 443
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["118.223.123.161/32"]
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
description = "http fron grafana"
|
||||||
|
from_port = 80
|
||||||
|
to_port = 80
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["118.223.123.161/32"]
|
||||||
|
}
|
||||||
|
|
||||||
|
egress {
|
||||||
|
from_port = 0
|
||||||
|
to_port = 0
|
||||||
|
protocol = "-1"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
ipv6_cidr_blocks = ["::/0"]
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Name = "grafana-allow-security"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_instance" "grafana" {
|
||||||
|
ami = "ami-0409b7ddbc59e3222"
|
||||||
|
instance_type = "t3.small"
|
||||||
|
key_name = "kp-jay-bastion-datasaker"
|
||||||
|
vpc_security_group_ids = [aws_security_group.grafana-allow-security.id]
|
||||||
|
availability_zone = "ap-northeast-2c"
|
||||||
|
subnet_id = var.Public_Subnet_ID_1
|
||||||
|
|
||||||
|
root_block_device {
|
||||||
|
delete_on_termination = true
|
||||||
|
volume_size = 30
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Name = "grafana"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
10
aws_instance/terraform_grafana_230430/main.tf
Normal file
10
aws_instance/terraform_grafana_230430/main.tf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
provider "aws" {
|
||||||
|
region = "ap-northeast-2"
|
||||||
|
}
|
||||||
|
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
archive = "~> 1.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
35
aws_instance/terraform_grafana_230430/variables.tf
Normal file
35
aws_instance/terraform_grafana_230430/variables.tf
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#---------------------------------------------------------------#
|
||||||
|
# Network ID
|
||||||
|
|
||||||
|
variable "VPC_ID" {
|
||||||
|
default = "vpc-00ba2b0e9ad59f0ed"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Network_CIDR" {
|
||||||
|
default = "172.24.0.0/19"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Private_Subnet_ID_1" {
|
||||||
|
default = "subnet-024f0deda82039fa4"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Private_Subnet_ID_2" {
|
||||||
|
default = "subnet-050d942fa1c46540a"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Private_Subnet_ID_3" {
|
||||||
|
default = "subnet-0946eb806af7377be"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Public_Subnet_ID_1" {
|
||||||
|
default = "subnet-00c363356f133411d"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Public_Subnet_ID_2" {
|
||||||
|
default = "subnet-07aa5e879a262014d"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "Public_Subnet_ID_3" {
|
||||||
|
default = "subnet-0073a61bc56a68a3e"
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user