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

Ini iyang #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions 01_05_base/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added 01_05_base/bartuah-tfplan
Binary file not shown.
20 changes: 10 additions & 10 deletions 01_05_base/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# //////////////////////////////
####### //////////////////////////////
# VARIABLES
# //////////////////////////////
variable "aws_access_key" {}
Expand All @@ -10,11 +10,11 @@ variable "ssh_key_name" {}
variable "private_key_path" {}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}

variable "vpc_cidr" {
default = "172.16.0.0/16"
default = "172.16.0.0/24"
}

variable "subnet1_cidr" {
Expand All @@ -35,27 +35,27 @@ provider "aws" {
# //////////////////////////////

# VPC
resource "aws_vpc" "vpc1" {
resource "aws_vpc" "vpc2" {
cidr_block = var.vpc_cidr
enable_dns_hostnames = "true"
}

# SUBNET
resource "aws_subnet" "subnet1" {
cidr_block = var.subnet1_cidr
vpc_id = aws_vpc.vpc1.id
vpc_id = aws_vpc.vpc2.id
map_public_ip_on_launch = "true"
availability_zone = data.aws_availability_zones.available.names[1]
}

# INTERNET_GATEWAY
resource "aws_internet_gateway" "gateway1" {
vpc_id = aws_vpc.vpc1.id
vpc_id = aws_vpc.vpc2.id
}

# ROUTE_TABLE
resource "aws_route_table" "route_table1" {
vpc_id = aws_vpc.vpc1.id
vpc_id = aws_vpc.vpc2.id

route {
cidr_block = "0.0.0.0/0"
Expand All @@ -71,7 +71,7 @@ resource "aws_route_table_association" "route-subnet1" {
# SECURITY_GROUP
resource "aws_security_group" "sg-nodejs-instance" {
name = "nodejs_sg"
vpc_id = aws_vpc.vpc1.id
vpc_id = aws_vpc.vpc2.id

ingress {
from_port = 80
Expand Down Expand Up @@ -113,7 +113,7 @@ resource "aws_instance" "nodejs1" {
connection {
type = "ssh"
host = self.public_ip
user = "ec2-user"
user = "ec2-user"
private_key = file(var.private_key_path)
}
}
Expand Down Expand Up @@ -151,4 +151,4 @@ data "aws_ami" "aws-linux" {
# //////////////////////////////
output "instance-dns" {
value = aws_instance.nodejs1.public_dns
}
}
27 changes: 27 additions & 0 deletions bartuah.tf_key.pem.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAuKhMvZK1ovmdpi5iwVmkSzE5TyUI4LPz7b8eC21lacDrXtTM
LgptuW7fL1nX7skkdI2QsAjyzt4WL8ASp9WlGGE0R8H72v4PmVGHy5bPMss9CuNR
wKvmQaci5LJq3ldg6V2Eq/rpWyjUGbztPnuzKvFqnZpvvoFDb8bwUe3TvLsGz/0t
VSzfsA5ZCtcVkw6MxFDZ5AUkbhR66qlCKKIv2XU2gc1LsSwMsFSUeVPg3UHGwh9g
qg5Tz3tRgi/C5ViT3pb495SKDZmTdIducbjg7zA4FHuSVECk4GvR1uLykVe+Rx0T
ZRX7M3AY0vCoUWT13fzWOngIiZtkbVV2PKiTcQIDAQABAoIBAHqzeqrNfdyZuWPf
lseb5UwBnW810LxfV0s3n6NAQg8PnlcZV8OQMnDxd2RjctS823iHSQlwKMfFU0DP
hJX5pQaaML8t60kNYRgj0PQ7ddruqdU+T+iTUSF3CfylgdXUghUPi0UsKTvl2Wpw
28SVNeznFk07fd08z67Kpo4KVpQlIcthy+U45z4keZaqFdOaEp98f9WTKT2ZvHh5
VNXXz8NOt74/3LeIiQXTw/LrbjjhPm9DwtQJlbMW6QrYP3YQx/igam8TwKZ60SGx
CF3XWcpRsxSh3g74L9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