Skip to content

Commit

Permalink
fix: Updated the object-based configuration in variable.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhomesh committed Nov 16, 2024
1 parent 54f3b02 commit beb2ce3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
8 changes: 4 additions & 4 deletions examples/basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ module "ec2" {
#instance
instance_count = 1
instance_configuration = {
ami = "ami-08d658f84a6d84a80"
instance_type = "c4.xlarge"
ami = "ami-08d658f84a6d84a80"
instance_type = "c4.xlarge"

#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
volume_size = 15
delete_on_termination = true
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ module "ec2" {
#Instance
instance_count = 1
instance_configuration = {
ami = "ami-0f8e81a3da6e2510a"
instance_type = "t2.nano"
ami = "ami-0f8e81a3da6e2510a"
instance_type = "t2.nano"

#Root Volume
root_block_device = [
Expand Down
10 changes: 5 additions & 5 deletions examples/spot_instance/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ module "spot-ec2" {

# Spot-instance
spot_configuration = {
spot_price = "0.3"
spot_price = "0.3"
wait_for_fulfillment = true
spot_type = "persistent"
spot_type = "persistent"
instance_interruption_behavior = "terminate"
spot_instance_enabled = true
spot_instance_count = 1
instance_type = "c4.xlarge"
spot_instance_enabled = true
spot_instance_count = 1
instance_type = "c4.xlarge"

root_block_device = [
{
Expand Down
18 changes: 9 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@ resource "aws_route53_record" "default" {
## Below Provides an EC2 Spot Instance Request resource. This allows instances to be requested on the spot market..
##----------------------------------------------------------------------------------
resource "aws_spot_instance_request" "default" {
count = var.enable && var.spot_instance_enabled ? var.spot_instance_count : 0
spot_price = var.spot_configuration.spot_price
wait_for_fulfillment = var.spot_configuration.wait_for_fulfillment
spot_type = var.spot_configuration.spot_type
launch_group = var.spot_configuration.launch_group
block_duration_minutes = var.spot_configuration.block_duration_minutes
instance_interruption_behavior = var.spot_configuration.instance_interruption_behavior
valid_until = var.spot_configuration.valid_until
valid_from = var.spot_configuration.valid_from
count = var.enable && var.spot_instance_enabled ? var.spot_instance_count : 0
spot_price = var.spot_configuration.spot_price
wait_for_fulfillment = var.spot_configuration.wait_for_fulfillment
spot_type = var.spot_configuration.spot_type
launch_group = var.spot_configuration.launch_group
block_duration_minutes = var.spot_configuration.block_duration_minutes
instance_interruption_behavior = var.spot_configuration.instance_interruption_behavior
valid_until = var.spot_configuration.valid_until
valid_from = var.spot_configuration.valid_from

# Instance configuration
ami = var.instance_configuration.ami == "" ? data.aws_ami.ubuntu.id : var.instance_configuration.ami
Expand Down
34 changes: 17 additions & 17 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,26 @@ variable "instance_configuration" {
disable_api_termination = optional(bool, false)
instance_initiated_shutdown_behavior = optional(string, "stop")
placement_group = optional(string, "")
tenancy = optional(string, "default")
host_id = optional(string, null)
cpu_core_count = optional(number, null)
cpu_threads_per_core = optional(number, null)
user_data = optional(string, "")
user_data_base64 = optional(string, null)
user_data_replace_on_change = optional(bool, null)
tenancy = optional(string, "default")
host_id = optional(string, null)
cpu_core_count = optional(number, null)
cpu_threads_per_core = optional(number, null)
user_data = optional(string, "")
user_data_base64 = optional(string, null)
user_data_replace_on_change = optional(bool, null)
availability_zone = optional(string, null)
get_password_data = optional(bool, null)
private_ip = optional(string, null)
secondary_private_ips = optional(list(string), null)
source_dest_check = optional(bool, true)
ipv6_address_count = optional(number, null)
ipv6_addresses = optional(list(string), null)
hibernation = optional(bool, false)
root_block_device = optional(list(any), [])
ephemeral_block_device = optional(list(any), [])
get_password_data = optional(bool, null)
private_ip = optional(string, null)
secondary_private_ips = optional(list(string), null)
source_dest_check = optional(bool, true)
ipv6_address_count = optional(number, null)
ipv6_addresses = optional(list(string), null)
hibernation = optional(bool, false)
root_block_device = optional(list(any), [])
ephemeral_block_device = optional(list(any), [])
})
default = {
instance_type = "t2.micro" # Providing a default instance type
instance_type = "t2.micro" # Providing a default instance type
}
}

Expand Down

0 comments on commit beb2ce3

Please sign in to comment.