Adds AWS Instances to Output

This commit is contained in:
2023-09-23 06:46:03 -03:00
parent dbba207527
commit a9eb18c332
5 changed files with 24 additions and 75 deletions

View File

@@ -1,11 +1,11 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.17.0"
configuration_aliases = [ aws.main ]
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.17.0"
configuration_aliases = [ aws.main ]
}
}
}
}
@@ -66,9 +66,8 @@ resource "aws_instance" "main" {
key_name = aws_key_pair.ssh_key_main.key_name
user_data = templatefile("${path.module}/scripts/setup_main.sh", {
user_data = templatefile("${path.module}/scripts/setup_server.sh", {
extra_key = aws_key_pair.ssh_key_ci_cd.public_key
k3s_token = var.k3s_token
})
tags = {
@@ -84,10 +83,8 @@ resource "aws_instance" "worker" {
key_name = aws_key_pair.ssh_key_main.key_name
user_data = templatefile("${path.module}/scripts/setup_worker.sh", {
user_data = templatefile("${path.module}/scripts/setup_server.sh", {
extra_key = aws_key_pair.ssh_key_ci_cd.public_key
k3s_token = var.k3s_token
k3s_cluster_ip = var.project_domain
})
tags = {
@@ -100,4 +97,12 @@ resource "aws_instance" "worker" {
output "pool_master_public_ip" {
value = aws_instance.main.public_ip
}
output "pool_master_instance" {
value = aws_instance.main
}
output "pool_worker_instances" {
value = aws_instance.worker
}