Skip to content

Commit

Permalink
feat(ebs): Add defaults ebs to ec2 module (#95)
Browse files Browse the repository at this point in the history
* feat(ec2): Add defaults to ebs inside ec2

* fix(trade-infra): fix default az in ebs

* fix(ec2): Add defaults of ebs

* feat(ebs): Add ebs tagname default

* fix(ebs): Fix default device name
  • Loading branch information
portellikurt authored Nov 12, 2024
1 parent 21e09ab commit b98b313
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions aws/ec2/ebs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ resource "aws_ebs_volume" "this" {
count = var.ebs != null ? 1 : 0

size = var.ebs.size
tags = var.ebs.tags
availability_zone = var.ebs.az
availability_zone = var.ebs.az != null ? var.ebs.az : var.availability_zone
type = var.ebs.type
iops = var.ebs.iops

tags = {
Name = var.ebs.tagName != null ? var.ebs.tagName : "${var.name}-ebs${var.ebs.size}g"
}
}

resource "aws_volume_attachment" "this" {
Expand Down
8 changes: 4 additions & 4 deletions aws/ec2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ variable "key_pair" {
variable "ebs" {
type = object({
size = number
device_name = string
az = string
type = string
device_name = optional(string, "xvdf")
az = optional(string)
type = optional(string)
iops = optional(string)
tags = map(string)
tagName = optional(string)
})

default = null
Expand Down

0 comments on commit b98b313

Please sign in to comment.