GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — terraformcodesDecemberbatch/ubuntuserver.tf at main · Mors91/terraformcodesDecemberbatch

Expand file tree

/

ubuntuserver.tf

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
121 lines (105 loc) · 3.36 KB
/

ubuntuserver.tf

Copy path

File metadata and controls

121 lines (105 loc) · 3.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
resource "aws_instance" "ubuntuserver" {
ami = data.aws_ami.ubuntu.id
instance_type = var.instance_type
key_name = aws_key_pair.ubuntudeployer.key_name
subnet_id = aws_subnet.main-public.id
vpc_security_group_ids = [aws_security_group.allow_ssh.id]
user_data_base64 = data.cloudinit_config.userdata.rendered
# Establishes connection to be used by all
# generic remote provisioners (i.e. file/remote-exec)
connection {
type = "ssh"
user = "ubuntu"
private_key = file(var.path_private_key)
host = self.public_ip
}
provisioner "remote-exec" {
inline = [
"sudo apt update -y",
"sudo apt install nginx -y"
]
}
tags = merge(local.common_tags, { Name = "ubuntuserver", Company = "EliteSolutionsIT", "Dummy" = "dummytag" })
}
///key
resource "aws_key_pair" "ubuntudeployer" {
key_name = join("-", [local.network.Environment, "ubuntuserverKey"])
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDDgLEV7ZLoOlbLrvb8MzsZwzoiHUh/LIJXF8QQmL9oR3nM2OjngbAG83OqSRzvsnehCc8RQER1ItL49OdjCpPs+lfY8UQt/6Gzdu5LwqyydgmPw44hizHiNTBSDy7yWP1+o4f4Z7thOeAsUcOedZuMW6mK7wE027b6+xcCaVZM9t0rhbpNfllYGOF6o44bgUbU5tXmoDbBBm8Ww4TtVnV0Bs7mPJgsiwC8f0pt5WV6ARhvf1vlPuCISXNq/oKLMnnfIR3SO6YzJYbQVHSxJRame1+ceCR3H97YdfRDFe3IJONKOxfSOXcCTfIB5dLOGSFlSSn0q0JgTdQaZs+4Bg1Do2ed8D4e9sfYj02xIbuWKywup52BZchWpNSb2Hwj8q0Ow9nr359WtNWR1WwcwfO3aHuZx8jKqpdH2wV/E/Xob5psmipbUvJw1AtQcMF+Z0l4qN5FDijpxt+4OQuPUfKlN1wTGVBscaHzT977kassHs9/GowoZCaE2NAcdeyb2C0= lbena@LAPTOP-QB0DU4OG"
}
///Security Group
resource "aws_security_group" "allow_ssh" {
name = join("-", [local.network.Environment, "allow_ssh"])
description = "Allow RDP inbound traffic"
vpc_id = aws_vpc.main.id
ingress {
description = "TLS from VPC"
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["70.114.65.185/32"]
}
ingress {
description = "TLS from VPC"
from_port = 80
to_port = 80
protocol = "tcp"
security_groups = [aws_security_group.allow_alb.id]
}
ingress {
description = "TLS from VPC"
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["70.114.65.185/32"]
}
ingress {
description = "TLS from VPC"
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["70.114.65.185/32"]
}
ingress {
description = "TLS from VPC"
from_port = 443
to_port = 443
protocol = "tcp"
security_groups = [aws_security_group.allow_alb.id]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "ubuntu-sg"
Environment = "dev"
Managedwith = "terraform"
}
}
///alb sg
resource "aws_security_group" "allow_alb" {
name = join("-", [local.network.Environment, "allow_alb"])
description = "Allow RDP inbound traffic"
vpc_id = aws_vpc.main.id
ingress {
description = "TLS from VPC"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["70.114.65.185/32"]
}
ingress {
description = "TLS from VPC"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["70.114.65.185/32"]
}
tags = {
Name = "alb-sg"
Environment = "dev"
Managedwith = "terraform"
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.