Skip to content

Commit

Permalink
Merge pull request #9 from hazelops/feature/wip
Browse files Browse the repository at this point in the history
Add support for graviton instance, default to t4g.nano
  • Loading branch information
AutomationD authored Jan 1, 2025
2 parents e8a289a + d30da3d commit a21ae7e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data "aws_ami" "this" {

filter {
name = "name"
values = ["al2023-ami-2023*-*-x86_64"]
values = ["al2023-ami-2023*-*-${local.instance_arch}"]
}

filter {
Expand Down
8 changes: 8 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
locals {
instance_arch = contains([
"t4g",
"m6g",
"c6g",
"r6g"
], substr(var.instance_type, 0, 3)) ? "arm64" : "x86_64"
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
resource "aws_security_group" "this" {
count = var.manage_security_group ? 1 : 0
vpc_id = var.vpc_id
name = "${var.env}-${var.name}"

ingress {
protocol = "tcp"
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ variable "ec2_key_pair_name" {
variable "instance_type" {
type = string
description = "EC2 instance type for bastion host"
default = "t3.nano"
default = "t4g.nano"
}

variable "instance_ami" {
type = string
type = string
description = "AMI ID override for the bastion host. Keep in mind, this module config is targeting Amazon Linux 2023)"
default = ""
default = ""
}

variable "security_groups" {
Expand Down

0 comments on commit a21ae7e

Please sign in to comment.