Skip to content
Merged
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
9 changes: 3 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ locals {
ssh_key_name = var.ssh_key_name
public_ssh_key = var.public_ssh_key # create when public key is given, otherwise select with name

ifconfig_co_json = jsondecode(data.http.my_public_ip[0].response_body)
ip = (local.security_group_ip == "" ? local.ifconfig_co_json.ip : local.security_group_ip)
ipinfo_ip = chomp(data.http.my_public_ip[0].response_body)
ip = (local.security_group_ip == "" ? local.ipinfo_ip : local.security_group_ip)
}

data "http" "my_public_ip" {
count = (local.security_group_ip == "" ? 1 : 0)
url = "https://ifconfig.co/json"
request_headers = {
Accept = "application/json"
}
url = "https://ipinfo.io/ip"
}

module "vpc" {
Expand Down
2 changes: 1 addition & 1 deletion modules/security_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ locals {
create = (var.type != "" ? 1 : 0) # create if given a type
type = (local.types[(var.type == "" ? "none" : var.type)])
owner = var.owner
ip = var.ip
ip = chomp(var.ip)
cidr = var.cidr
vpc_id = var.vpc_id
vpc_cidr = var.vpc_cidr
Expand Down
5 changes: 5 additions & 0 deletions modules/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ resource "aws_vpc" "new" {
Name = local.name
}
assign_generated_ipv6_cidr_block = true
lifecycle {
ignore_changes = [
default_network_acl_id,
]
}
}

resource "aws_internet_gateway" "new" {
Expand Down