terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
758 stars 1.88k forks source link

Terraform plan showing 2 update in-place changes #346

Closed adartsecitizen closed 1 year ago

adartsecitizen commented 1 year ago

Hi Team,

I am using the public registry EC2 module -> terraform-aws-modules/ec2-instance/aws to test out the import functionality of Terraform 1.5.x. I created an EC2 instance using the module for the testing.

When I tried importing the EC2 instance using the same EC2 module (I deleted the terraform.tfstate to simulate), Terraform plan was showing 2 update in-place changes. I can't figure out where the change is coming from.

I am expecting no changes as I have used the same EC2 module and main.tf config - no changes in parameters. I only deleted the terraform.tfstate to simulate the import.

Is this a bug? Any insights on how to fix this? Thanks.


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:

module.ec2_private["0"].aws_instance.this[0] will be updated in-place

(imported from "i-0d9fc1c2d85639717")

~ resource "aws_instance" "this" { ami = "ami-0ee3dd41c47751fe6" arn = "arn:aws:ec2:us-east-1:163240833505:instance/i-0d9fc1c2d85639717" associate_public_ip_address = false availability_zone = "us-east-1a" cpu_core_count = 1 cpu_threads_per_core = 1 disable_api_stop = false disable_api_termination = false ebs_optimized = false get_password_data = false hibernation = false id = "i-0d9fc1c2d85639717" instance_initiated_shutdown_behavior = "stop" instance_state = "running" instance_type = "t2.micro" ipv6_address_count = 0 ipv6_addresses = [] key_name = "terraform-key-rc_is-lab_account" monitoring = false placement_partition_number = 0 primary_network_interface_id = "eni-0a025e9b1e5b4b948" private_dns = "ip-10-0-1-102.ec2.internal" private_ip = "10.0.1.102" secondary_private_ips = [] security_groups = [] source_dest_check = true subnet_id = "subnet-0ee9f8fc6fc759978" tags = { "Department" = "it" "Name" = "sandbox-vm-0" "Team" = "it-devops" "Terraform" = "true" "environment" = "sandbox" "owners" = "it" } tags_all = { "Department" = "it" "Name" = "sandbox-vm-0" "Team" = "it-devops" "Terraform" = "true" "environment" = "sandbox" "owners" = "it" } tenancy = "default"

Plan: 5 to import, 0 to add, 2 to change, 0 to destroy.

Changes to Outputs:

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 1 year ago

This issue was automatically closed because of stale in 10 days

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.