aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/terraform-aws-1n-aws-c5n
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-07-14 07:34:30 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-07-14 08:25:46 +0000
commit6cfd831b241b9711c8573364c9e59d0e9ec2cdad (patch)
tree3ff2e25d38af4037757cebeecc9f6b79c782be96 /fdio.infra.terraform/terraform-aws-1n-aws-c5n
parent942a580ecb880a0a8b886bc247b40ca43c96abb9 (diff)
feat(aws): Add new flavors
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: Ie63b3d6c7ff376d808587e7c96f386946c939a81
Diffstat (limited to 'fdio.infra.terraform/terraform-aws-1n-aws-c5n')
-rw-r--r--fdio.infra.terraform/terraform-aws-1n-aws-c5n/main.tf27
-rw-r--r--fdio.infra.terraform/terraform-aws-1n-aws-c5n/variables.tf2
-rw-r--r--fdio.infra.terraform/terraform-aws-1n-aws-c5n/versions.tf2
3 files changed, 19 insertions, 12 deletions
diff --git a/fdio.infra.terraform/terraform-aws-1n-aws-c5n/main.tf b/fdio.infra.terraform/terraform-aws-1n-aws-c5n/main.tf
index da6367e922..356a5c48e1 100644
--- a/fdio.infra.terraform/terraform-aws-1n-aws-c5n/main.tf
+++ b/fdio.infra.terraform/terraform-aws-1n-aws-c5n/main.tf
@@ -38,17 +38,24 @@ module "subnet_b" {
}
# Create Private Key
-resource "tls_private_key" "private_key" {
- algorithm = var.private_key_algorithm
+module "private_key" {
+ source = "pmikus/private-key/tls"
+ version = "4.0.4"
+
+ private_key_algorithm = var.private_key_algorithm
}
# Create Key Pair
-resource "aws_key_pair" "key_pair" {
- depends_on = [
- tls_private_key.private_key
- ]
- key_name = local.key_pair_key_name
- public_key = tls_private_key.private_key.public_key_openssh
+module "key_pair" {
+ source = "pmikus/key-pair/aws"
+ version = "5.7.0"
+
+ key_pair_key_name = local.key_pair_key_name
+ key_pair_public_key = module.private_key.public_key_openssh
+
+ key_pair_tags = {
+ "Environment" = local.environment
+ }
}
# Create Placement Group
@@ -68,7 +75,7 @@ resource "aws_instance" "tg" {
associate_public_ip_address = var.tg_associate_public_ip_address
instance_initiated_shutdown_behavior = var.tg_instance_initiated_shutdown_behavior
instance_type = var.tg_instance_type
- key_name = aws_key_pair.key_pair.key_name
+ key_name = module.key_pair.key_pair_key_name
placement_group = aws_placement_group.placement_group.id
private_ip = var.tg_private_ip
source_dest_check = var.tg_source_dest_check
@@ -165,7 +172,7 @@ resource "null_resource" "deploy_tg" {
connection {
user = "ubuntu"
host = aws_instance.tg.public_ip
- private_key = tls_private_key.private_key.private_key_pem
+ private_key = module.private_key.private_key_pem
}
provisioner "remote-exec" {
diff --git a/fdio.infra.terraform/terraform-aws-1n-aws-c5n/variables.tf b/fdio.infra.terraform/terraform-aws-1n-aws-c5n/variables.tf
index 673585aacb..566a073266 100644
--- a/fdio.infra.terraform/terraform-aws-1n-aws-c5n/variables.tf
+++ b/fdio.infra.terraform/terraform-aws-1n-aws-c5n/variables.tf
@@ -38,7 +38,7 @@ variable "placement_group_strategy" {
variable "tg_ami" {
description = "AMI to use for the instance."
type = string
- default = "ami-098a7a7d220d31850"
+ default = "ami-07430bfa17fd4e597"
}
variable "tg_associate_public_ip_address" {
diff --git a/fdio.infra.terraform/terraform-aws-1n-aws-c5n/versions.tf b/fdio.infra.terraform/terraform-aws-1n-aws-c5n/versions.tf
index 693c86c9f6..7e17bb4924 100644
--- a/fdio.infra.terraform/terraform-aws-1n-aws-c5n/versions.tf
+++ b/fdio.infra.terraform/terraform-aws-1n-aws-c5n/versions.tf
@@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.1.0"
+ version = ">= 5.7.0"
}
null = {
source = "hashicorp/null"