정리
This commit is contained in:
9
modules/cgw/main.tf
Normal file
9
modules/cgw/main.tf
Normal file
@ -0,0 +1,9 @@
|
||||
resource "aws_customer_gateway" "main" {
|
||||
bgp_asn = 65000
|
||||
ip_address = var.cgw_ip
|
||||
type = "ipsec.1"
|
||||
|
||||
tags = {
|
||||
Name = "cgw"
|
||||
}
|
||||
}
|
3
modules/cgw/outputs.tf
Normal file
3
modules/cgw/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
||||
output "cgw_id" {
|
||||
value = aws_customer_gateway.main.id
|
||||
}
|
3
modules/cgw/variables.tf
Normal file
3
modules/cgw/variables.tf
Normal file
@ -0,0 +1,3 @@
|
||||
variable "cgw_ip" {
|
||||
type = string
|
||||
}
|
11
modules/ec2/eks-host.sh
Normal file
11
modules/ec2/eks-host.sh
Normal file
@ -0,0 +1,11 @@
|
||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||
unzip awscliv2.zip
|
||||
sudo ./aws/install
|
||||
export PATH=/usr/local/bin:$PATH
|
||||
source ~/.bash_profile
|
||||
curl -o /usr/local/bin/kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.23.13/2022-10-31/bin/linux/amd64/kubectl
|
||||
chmod +x /usr/local/bin/kubectl
|
||||
yum install -y jq
|
||||
yum install -y bash-completion
|
||||
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
|
||||
mv -v /tmp/eksctl /usr/local/bin
|
@ -7,11 +7,13 @@ resource "aws_network_interface" "eni" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_instance" "ubuntu" {
|
||||
resource "aws_instance" "ec2" {
|
||||
ami = var.ami_name
|
||||
# "ami-0ab04b3ccbadfae1f"
|
||||
instance_type = var.instance_type
|
||||
# "t2.micro"
|
||||
|
||||
# user_data = var.user_data
|
||||
|
||||
tags = {
|
||||
Name = "${var.tag_name}"
|
||||
|
9
modules/ec2/mariadb.sh
Normal file
9
modules/ec2/mariadb.sh
Normal file
@ -0,0 +1,9 @@
|
||||
cat <<EOF>> /etc/yum.repos.d/MariaDB.repo
|
||||
[mariadb]
|
||||
name = MariaDB
|
||||
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
|
||||
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
|
||||
gpgcheck = 1
|
||||
EOF
|
||||
yum install mariadb-server -y
|
||||
systemctl enable --now mariadb
|
3
modules/ec2/nginx.sh
Normal file
3
modules/ec2/nginx.sh
Normal file
@ -0,0 +1,3 @@
|
||||
yum update -y
|
||||
amazon-linux-extras install -y nginx1
|
||||
systemctl enable --now nginx
|
@ -1,10 +1,10 @@
|
||||
output "ec2_id" {
|
||||
value = aws_instance.ubuntu.id
|
||||
value = aws_instance.ec2.id
|
||||
|
||||
}
|
||||
|
||||
output "public_ip_associate" {
|
||||
value = aws_instance.ubuntu.associate_public_ip_address
|
||||
value = aws_instance.ec2.associate_public_ip_address
|
||||
|
||||
}
|
||||
|
||||
|
@ -33,4 +33,5 @@ variable "sg_list" {
|
||||
description = "sg list"
|
||||
type = list(string)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ resource "aws_eks_cluster" "eks-cluster" {
|
||||
name = "${var.name}"
|
||||
role_arn = var.iam_role_arn
|
||||
|
||||
#enabled_cluster_log_types = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
|
||||
# enabled_cluster_log_types = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
|
||||
|
||||
vpc_config {
|
||||
security_group_ids = var.sg_list
|
||||
|
5
modules/transit-gateway-route-add/main.tf
Normal file
5
modules/transit-gateway-route-add/main.tf
Normal file
@ -0,0 +1,5 @@
|
||||
resource "aws_ec2_transit_gateway_route" "example" {
|
||||
destination_cidr_block = var.cidr
|
||||
transit_gateway_attachment_id = var.attatch_id
|
||||
transit_gateway_route_table_id = var.route_table_id
|
||||
}
|
0
modules/transit-gateway-route-add/outputs.tf
Normal file
0
modules/transit-gateway-route-add/outputs.tf
Normal file
13
modules/transit-gateway-route-add/variables.tf
Normal file
13
modules/transit-gateway-route-add/variables.tf
Normal file
@ -0,0 +1,13 @@
|
||||
variable "cidr" {
|
||||
description = "cidr"
|
||||
type = string
|
||||
|
||||
}
|
||||
variable "route_table_id" {
|
||||
description = "route_table_id"
|
||||
type = string
|
||||
|
||||
}
|
||||
variable "attatch_id" {
|
||||
type = string
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
output "tgw_id" {
|
||||
value = aws_ec2_transit_gateway.tgw.id
|
||||
}
|
||||
output "tgw_route-table_id" {
|
||||
value = aws_ec2_transit_gateway.tgw.association_default_route_table_id
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
output "attach_id" {
|
||||
value = aws_ec2_transit_gateway_vpc_attachment.tgw-vpc-attatch.id
|
||||
|
||||
}
|
17
modules/vpn_conn/main.tf
Normal file
17
modules/vpn_conn/main.tf
Normal file
@ -0,0 +1,17 @@
|
||||
resource "aws_vpn_connection" "example" {
|
||||
customer_gateway_id = var.cgw_id
|
||||
|
||||
transit_gateway_id = var.tgw_id
|
||||
|
||||
type = "ipsec.1"
|
||||
|
||||
tunnel1_preshared_key = var.preshared_key
|
||||
tunnel2_preshared_key = var.preshared_key
|
||||
|
||||
static_routes_only = true
|
||||
tags = {
|
||||
Name = "terraform_ipsec_vpn_example"
|
||||
}
|
||||
}
|
||||
# outside_ip_address_type = "PrivateIpv4"
|
||||
# transport_transit_gateway_attachment_id = data.aws_ec2_transit_gateway_dx_gateway_attachment.example.id
|
10
modules/vpn_conn/outputs.tf
Normal file
10
modules/vpn_conn/outputs.tf
Normal file
@ -0,0 +1,10 @@
|
||||
output "vpn_conn_tunnel-1_ip" {
|
||||
value = aws_vpn_connection.example.tunnel1_address
|
||||
}
|
||||
output "vpn_conn_tunnel-2_ip" {
|
||||
value = aws_vpn_connection.example.tunnel2_address
|
||||
}
|
||||
output "attach_id" {
|
||||
value = aws_vpn_connection.example.transit_gateway_attachment_id
|
||||
|
||||
}
|
13
modules/vpn_conn/variables.tf
Normal file
13
modules/vpn_conn/variables.tf
Normal file
@ -0,0 +1,13 @@
|
||||
variable "cgw_id" {
|
||||
type = string
|
||||
|
||||
}
|
||||
|
||||
variable "tgw_id" {
|
||||
type = string
|
||||
|
||||
}
|
||||
variable "preshared_key" {
|
||||
type = string
|
||||
|
||||
}
|
Reference in New Issue
Block a user