summaryrefslogtreecommitdiff
path: root/playground/ec2-instance-test
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-12-16 21:39:01 +0200
committerPaul Buetow <paul@buetow.org>2023-12-16 21:39:01 +0200
commitfc92c488f7a44ab3b75fa90db6bbe183eafdcd80 (patch)
treec48bc8c1d317b1fddb86a8e5a80432be319c12e4 /playground/ec2-instance-test
parent15d2a6389a953494c3d082ab00c90d432c0f9eca (diff)
reuse already existing DNS zone
Diffstat (limited to 'playground/ec2-instance-test')
-rw-r--r--playground/ec2-instance-test/main.tf4
-rw-r--r--playground/ec2-instance-test/outputs.tf4
2 files changed, 2 insertions, 6 deletions
diff --git a/playground/ec2-instance-test/main.tf b/playground/ec2-instance-test/main.tf
index 3f946bd..8147f2e 100644
--- a/playground/ec2-instance-test/main.tf
+++ b/playground/ec2-instance-test/main.tf
@@ -164,12 +164,12 @@ resource "aws_instance" "my_instance" {
}
}
-resource "aws_route53_zone" "my_zone" {
+data "aws_route53_zone" "my_zone" {
name = "aws.buetow.org." # Replace with your domain name
}
resource "aws_route53_record" "my_record" {
- zone_id = aws_route53_zone.my_zone.zone_id
+ zone_id = data.aws_route53_zone.my_zone.zone_id
name = "${var.environment}-ec2-instance.aws.buetow.org" # Replace with your desired subdomain or leave empty for root
type = "A"
ttl = "300"
diff --git a/playground/ec2-instance-test/outputs.tf b/playground/ec2-instance-test/outputs.tf
index 9998834..9219aad 100644
--- a/playground/ec2-instance-test/outputs.tf
+++ b/playground/ec2-instance-test/outputs.tf
@@ -1,7 +1,3 @@
-output "name_servers" {
- value = aws_route53_zone.my_zone.name_servers
-}
-
output "public_ip" {
value = aws_instance.my_instance.public_ip
}