Skip to content

Commit

Permalink
Add the ability to specify default and additional tags for instances (#9
Browse files Browse the repository at this point in the history
)
  • Loading branch information
hskiba authored Jan 23, 2023
1 parent 64df327 commit ad867ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions instances.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ locals {
}

module "spot_requests" {
source = "frgrisk/ec2-spot/aws"
version = "~>0.3.0"
source = "frgrisk/ec2-spot/aws"
version = "~>0.3.2"

for_each = var.spot_requests

Expand All @@ -25,6 +25,7 @@ module "spot_requests" {
root_volume_size = coalesce(each.value.root_volume_size, 30)
additional_volumes = lookup(var.additional_volumes, each.key, {})
encrypt_volumes = var.encrypt_volumes
additional_tags = merge(var.default_tags, each.value.additional_tags)

user_data_replace_on_change = coalesce(each.value.user_data_replace_on_change, true)
}
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ variable "spot_requests" {
user_data = optional(string)
user_data_replace_on_change = optional(bool)
placement_group = optional(string)
additional_tags = optional(map(string))
}))
}

variable "default_tags" {
description = "Default tags to apply to all resources"
type = map(string)
default = {}
}

variable "tag_environment" {
description = "The name of the environment to use in resource tagging"
type = string
Expand Down

0 comments on commit ad867ae

Please sign in to comment.