-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Description
Everytime that a change is performed to an ec2 instance with more than 1 ebs volume attached, the terraform plan shows changes for all the ebs_block_devices as the following:
Objects have changed outside of Terraform
ebs_block_device {
- delete_on_termination = false -> null
- device_name = "/dev/sdb" -> null
- encrypted = true -> null
- iops = 16000 -> null
....(continues)....
ebs_block_device {
- delete_on_termination = false -> null
- device_name = "/dev/sdd" -> null
- encrypted = true -> null
- iops = 16000 -> null
....(continues)....
ebs_block_device {
+ delete_on_termination = false
+ device_name = "/dev/sdb"
+ encrypted = true
....(continues)....
+ ebs_block_device {
+ delete_on_termination = false
+ device_name = "/dev/sdd"
+ encrypted = true
This could become in a large terraform plan just with 6 ec2 instances with 6 volumes each which becomes a little harder to read and generates confusion because this is not being managed by the module as:
# ebs_block_device managed by separate resource
Since we are not using this feature, shall we include to both resources "aws_instance"."ignore_ami" and also resource "aws_instance"."this" the following ignore?
lifecycle {
ignore_changes = [
ebs_block_device,
]
If there is anything better or what I'm proposing has a huge impact and a lot of drawbacks please let me know. Happy to help on solving this issue that probably is affecting multiple persons
If your request is for a new feature, please use the Feature request template.
- โ I have searched the open/closed issues and my issue is not listed.
โ ๏ธ Note
Versions
-
Module version [Required]: This happens in the major 6 (all minors included)
-
Terraform version:
1.11 -
Provider version(s):
aws version 6
Reproduction Code [Required]
Create a ec2 instance with 6 EBS volumes, after the first terraform apply try to change the iops on all the volumes. That will trigger the plan with the additional "Objects have changed outside of Terraform"
module "ec2_test" {
source = "git::https://github.com/terraform-aws-modules/terraform-aws-ec2-instance.git?ref=c90bc6edc889c73bdd1e07f01b656d93902cf364"
name = "test"
# Instance Configuration
ami = "ami-x"
instance_type = "m7i.large"
availability_zone = "us-east-1a"
subnet_id = "subnet-x"
vpc_security_group_ids = ["sg-x"]
associate_public_ip_address = false
disable_api_termination = true
create_security_group = false
enable_volume_tags = false
metadata_options = {
http_endpoint = "enabled"
http_tokens = "optional"
http_put_response_hop_limit = 1
}
root_block_device = {
delete_on_termination = false
type = "gp3"
size = 75
iops = 16000
throughput = 1250
}
# Additional EBS Volumes
ebs_volumes = {
"/dev/sdd" = {
type = "gp3"
size = 100
multi_attach_enabled = false
iops = 16000
throughput = 1250
}
"/dev/sdc" = {
type = "gp3"
size = 100
multi_attach_enabled = false
iops = 16000
throughput = 1250
}
"/dev/sde" = {
type = "gp3"
size = 100
multi_attach_enabled = false
iops = 16000
throughput = 1250
}
"/dev/sdb" = {
type = "gp3"
size = 100
multi_attach_enabled = false
iops = 16000
throughput = 1250
}
}
# User Data
user_data = null
# Tags
tags = {
"test" = "yes"
}
# Lifecycle Configuration
user_data_replace_on_change = false
ignore_ami_changes = true
}
Expected behavior
Any change for all the ebs_block_device that the ec2 instance has attached should not appear in the terraform plan as "Objects have changed outside of Terraform"
Actual behavior
Drift is showing up even when there were no manual changes applied to the ec2 instance