terraform-provider-spotinst
terraform-provider-spotinst copied to clipboard
autoscaling_attributes state drift
when specifying multiple autoscaling_attributes
, terraform always show drift on plans/applies - it appears that only one attribute is retained.
Terraform Version
Terraform v1.2.3
Affected Resource(s)
- spotinst_elastigroup_aws
In particular integration_ecs.autoscale_attributes
Terraform Configuration Files
################################################################################
## Configuration
################################################################################
terraform {
required_version = "1.2.3"
required_providers {
spotinst = {
source = "spotinst/spotinst"
version = "1.81.0"
}
}
}
################################################################################
## Providers
################################################################################
provider "spotinst" {
token = var.spotinst_token
account = var.spotinst_account
}
################################################################################
## Resources
################################################################################
resource "spotinst_elastigroup_aws" "this" {
capacity_unit = "instance"
description = "test"
desired_capacity = 0
draining_timeout = 120
ebs_optimized = false
enable_monitoring = false
fallback_to_ondemand = true
health_check_grace_period = 300
health_check_type = "ECS_CLUSTER_INSTANCE"
health_check_unhealthy_duration_before_replacement = 120
iam_instance_profile = "ecsInstanceRole"
image_id = "ami-089b46fd88a494dea"
instance_types_ondemand = "c4.2xlarge"
instance_types_preferred_spot = [
"t3.medium",
"t3a.medium",
]
instance_types_spot = [
"m5.large",
"t3.medium",
"t3a.medium",
]
key_name = "default"
lifetime_period = "days"
max_size = 350
min_size = 0
name = "test"
orientation = "balanced"
persist_block_devices = false
persist_private_ip = false
persist_root_device = false
placement_tenancy = "default"
product = "Linux/UNIX"
region = "us-east-2"
security_groups = [
"sg-0e8c1ee2de9067b05",
]
spot_percentage = 100
subnet_ids = [
"subnet-0358e8f5db8b59006",
"subnet-0e82701dff333fc05",
"subnet-0d06c156506660460",
]
user_data = "test"
utilize_commitments = false
utilize_reserved_instances = false
integration_ecs {
autoscale_cooldown = 300
autoscale_is_auto_config = true
autoscale_is_enabled = true
autoscale_scale_down_non_service_tasks = false
cluster_name = "st1"
autoscale_attributes {
key = "attribute1"
value = "true"
}
autoscale_attributes {
key = "attribute2"
value = "true"
}
autoscale_attributes {
key = "attribute3"
value = "true"
}
autoscale_attributes {
key = "attribute4"
value = "true"
}
}
network_interface {
associate_public_ip_address = true
delete_on_termination = true
description = "default interface"
device_index = "0"
}
resource_tag_specification {
should_tag_amis = false
should_tag_enis = false
should_tag_snapshots = false
should_tag_volumes = false
}
revert_to_spot {
perform_at = "always"
}
tags {
key = "Name"
value = "test"
}
}
Debug Output
https://gist.github.com/akobir-mp/07e3e000c1b1f07324c80c4435327d7f
Expected Behavior
The autoscale_attributes
should not show changes.
Actual Behavior
autoscale_attributes
shows changes despite the fact that no changes were made. Only a single attribute is retained.
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# spotinst_elastigroup_aws.this will be updated in-place
~ resource "spotinst_elastigroup_aws" "this" {
id = "sig-7247c397"
name = "test"
# (36 unchanged attributes hidden)
~ integration_ecs {
# (5 unchanged attributes hidden)
+ autoscale_attributes {
+ key = "attribute2"
+ value = "true"
}
+ autoscale_attributes {
+ key = "attribute3"
+ value = "true"
}
+ autoscale_attributes {
+ key = "attribute4"
+ value = "true"
}
# (1 unchanged block hidden)
}
# (4 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Steps to Reproduce
- create a
spotinst_elastigroup_aws
resource with multipleautoscale_attributes
withinintegration_ecs
- terraform apply
- terraform plan with no modifications will show changes
Community Note
- Please vote on this issue by adding a 👍 reaction to help the community and maintainers prioritize this request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.