From 74b5323aa3faf95d01fd220b34b5641b9a96e6dd Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Sat, 20 Jan 2024 14:38:00 -0800 Subject: [PATCH] Add my IP address to terraform outputs --- terraform/main.tf | 4 ++++ terraform/outputs.tf | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/terraform/main.tf b/terraform/main.tf index 1d247bd..a627bca 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -6,6 +6,10 @@ provider "aws" { resource "random_pet" "name" {} +data "http" "myip" { + url = "http://ipv4.icanhazip.com" +} + module "vpc" { source = "terraform-aws-modules/vpc/aws" diff --git a/terraform/outputs.tf b/terraform/outputs.tf index 1f0be17..949d6d5 100644 --- a/terraform/outputs.tf +++ b/terraform/outputs.tf @@ -12,8 +12,9 @@ output "nameservers" { output "s3_bucket_name" { value = module.s3_bucket.s3_bucket_id } -#output "myip" { -#} +output "myip" { + value = "${chomp(data.http.myip.body)}" +} #output "aws_route53_zone" { # value = local.route53_zone