Skip to content

Commit f944d4f

Browse files
committed
version related updates
1 parent 25e9c16 commit f944d4f

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

deploy.tf

+29-28
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ variable "region" {
33
}
44

55
provider "aws" {
6-
region = "${var.region}"
7-
# region = "us-east-1" # Virginia
6+
# region = "${var.region}"
7+
region = "us-east-1" # Virginia
88
# region = "us-east-2" # Ohio
99
# region = "us-west-1" # California
1010
# region = "us-west-2" # Oregon
@@ -23,57 +23,58 @@ provider "aws" {
2323
}
2424

2525
resource "aws_instance" "ssocks" {
26-
count = 1 # number of copies to spin up - if you put 1000 here, your bill might surprise you...
27-
ami = "${data.aws_ami.ubuntu.id}"
28-
instance_type = "t2.micro"
29-
key_name = "ssocks_key"
26+
count = 1 # number of copies to spin up - if you put 1000 here, your bill might surprise you...
27+
ami = "${data.aws_ami.ubuntu.id}"
28+
instance_type = "t2.micro"
29+
key_name = "ssocks_key"
3030
security_groups = [
3131
"${aws_security_group.ssh_https.name}"
3232
]
3333

3434
provisioner "remote-exec" {
35-
script = "scripts/provision.sh"
35+
script = "scripts/provision.sh"
3636
connection {
3737
type = "ssh"
3838
user = "ubuntu"
3939
private_key = "${file("~/.ssh/ssocks_key.pem")}"
40+
host = self.public_ip
4041
}
4142
}
4243

4344
# Return the public dns names into a local file for later use.
4445
provisioner "local-exec" {
45-
command = "echo ${self.public_dns} >> public_dns.txt"
46+
command = "echo ${self.public_dns} >> public_dns.txt"
4647
}
4748
}
4849

4950
resource "aws_security_group" "ssh_https" {
50-
count = 1
51-
name = "ssh_https"
52-
description = "Allow all inbound traffic"
51+
# count = 1
52+
name = "ssh_https"
53+
description = "Allow all inbound traffic"
5354

5455
ingress {
55-
from_port = 443
56-
to_port = 443
57-
protocol = "tcp"
58-
cidr_blocks = ["0.0.0.0/0"]
56+
from_port = 443
57+
to_port = 443
58+
protocol = "tcp"
59+
cidr_blocks = ["0.0.0.0/0"]
5960
}
6061

6162
ingress {
62-
from_port = 22
63-
to_port = 22
64-
protocol = "tcp"
65-
cidr_blocks = ["0.0.0.0/0"]
63+
from_port = 22
64+
to_port = 22
65+
protocol = "tcp"
66+
cidr_blocks = ["0.0.0.0/0"]
6667
}
6768

6869
egress {
69-
from_port = 0
70-
to_port = 65535
71-
protocol = "tcp"
72-
cidr_blocks = ["0.0.0.0/0"]
70+
from_port = 0
71+
to_port = 65535
72+
protocol = "tcp"
73+
cidr_blocks = ["0.0.0.0/0"]
7374
}
7475

75-
tags = {
76-
Name = "ssh_https"
76+
tags = {
77+
Name = "ssh_https"
7778
}
7879
}
7980

@@ -90,13 +91,13 @@ data "aws_ami" "ubuntu" {
9091

9192
resource "null_resource" "after_cleanup" {
9293
provisioner "local-exec" {
93-
when = "destroy"
94-
command = "rm -f public_dns.txt"
94+
when = destroy
95+
command = "rm -f public_dns.txt"
9596
}
9697
}
9798

9899
resource "null_resource" "before_cleanup" {
99100
provisioner "local-exec" {
100-
command = "rm -f public_dns.txt"
101+
command = "rm -f public_dns.txt"
101102
}
102103
}

scripts/provision.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sudo bash -c 'cat >~/config.json <<EOL
77
{
88
"server":"0.0.0.0",
99
"server_port":443,
10-
"password":"supersecret",
10+
"password":"holymoly",
1111
"timeout":300,
1212
"method":"aes-256-cfb",
1313
"fast_open": true

0 commit comments

Comments
 (0)