Remove prompt for local IP
This commit is contained in:
parent
e92d9f5f54
commit
386a530251
1 changed files with 3 additions and 4 deletions
7
main.tf
7
main.tf
|
|
@ -57,9 +57,8 @@ data "aws_ami" "image" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "your_ip" {
|
data "http" "myip" {
|
||||||
type = string
|
url = "http://ipv4.icanhazip.com"
|
||||||
description = "Your global IP for SSH access"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_security_group" "ssh" {
|
resource "aws_security_group" "ssh" {
|
||||||
|
|
@ -81,7 +80,7 @@ resource "aws_security_group_rule" "ssh" {
|
||||||
to_port = 22
|
to_port = 22
|
||||||
from_port = 22
|
from_port = 22
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
cidr_blocks = [ "${var.your_ip}/32"]
|
cidr_blocks = [ "${chomp(data.http.myip.body)}/32" ]
|
||||||
security_group_id = aws_security_group.ssh.id
|
security_group_id = aws_security_group.ssh.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue