Git Product home page Git Product logo

Comments (11)

ranvijayj avatar ranvijayj commented on June 6, 2024

@mitchellh Could be a major bug.

@phinze I think there was some issue like this before. Please let me know if you need more details

from terraform-plugin-sdk.

ranvijayj avatar ranvijayj commented on June 6, 2024

So, I do a terraform plan and apply
then without changing anything I do a terraform plan it still shows changes...

from terraform-plugin-sdk.

apparentlymart avatar apparentlymart commented on June 6, 2024

Sorry for this strange failure @ranvijayj, and thanks for reporting it.

Unfortunately the "diffs didn't match during apply" family of errors can be raised for a number of reasons, so it may or may not be related to other cases producing similar messages.

In this case, based on the information in the error output it seems like the diffs for the root_block_device block are no longer present when we try to update the diff during the apply step.

      root_block_device.#:                               "1" => "0"
      root_block_device.0.delete_on_termination:         "false" => "true" (forces new resource)

@jbardin, do you think this could be a symptom of hashicorp/terraform#17117? While the result was different in that bug, it did relate to items being removed from the diff. I'm not totally sure, since indeed it seems like in this case we successfully created the right diff during the plan stage but then some attributes were missed during the follow-up diff.

from terraform-plugin-sdk.

jbardin avatar jbardin commented on June 6, 2024

@apparentlymart: I don't know if it's the cause, but I think it's related. Only showing delete_on_termination makes sense if it was removed for some reason, as that's the only default field. I'm not sure why it would be the only change however if the count is going from 1 to 0.

from terraform-plugin-sdk.

ranvijayj avatar ranvijayj commented on June 6, 2024

Config of ec2 module that I am using: https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws/1.1.0

# EC2 instance
######
resource "aws_instance" "instance" {
  count = "${var.count}"

  ami                    = "${var.ami}"
  instance_type          = "${var.instance_type}"
  user_data              = "${var.user_data}"
  subnet_id              = "${var.subnet_id}"
  key_name               = "${var.key_name}"
  monitoring             = "${var.monitoring}"
  vpc_security_group_ids = ["${var.vpc_security_group_ids}"]
  iam_instance_profile   = "${var.iam_instance_profile}"

  associate_public_ip_address = "${var.associate_public_ip_address}"
  private_ip                  = "${var.private_ip}"
  ipv6_address_count          = "${var.ipv6_address_count}"
  ipv6_addresses              = "${var.ipv6_addresses}"

  ebs_optimized          = "${var.ebs_optimized}"
  volume_tags            = "${var.volume_tags}"
  root_block_device      = "${var.root_block_device}"
  ephemeral_block_device = "${var.ephemeral_block_device}"

   ebs_block_device {
    device_name = "/dev/sda1"
    volume_size = "${var.disk_size}"
    volume_type = "gp2"
    delete_on_termination = false
  }

  source_dest_check                    = "${var.source_dest_check}"
  disable_api_termination              = "${var.disable_api_termination}"
  instance_initiated_shutdown_behavior = "${var.instance_initiated_shutdown_behavior}"
  availability_zone                    = "${var.availability_zone}"
  placement_group                      = "${var.placement_group}"
  tenancy                              = "${var.tenancy}"

  # Note: network_interface can't be specified together with associate_public_ip_address
  # network_interface = "${var.network_interface}"

  tags = "${merge(var.tags, map("Name", format("%s-%d", var.name, count.index+1)))}"
}```



If this helps? but value is still false here. First time apply works fine then later on it shows that this needs to be changed to true. Please do let me know whenever you guys have an update. 

from terraform-plugin-sdk.

ranvijayj avatar ranvijayj commented on June 6, 2024

@jbardin I can share my entire code base with you once for this setup. Let me know..

Also, if I change nothing; I just do a terraform plan apply then terraform plan without any changes it still shows the same change to applied like I shared in the first comment.

I even downgraded to terraform 0.11.0 still no help..

from terraform-plugin-sdk.

ranvijayj avatar ranvijayj commented on June 6, 2024

Code: https://drive.google.com/open?id=1__aoVg0ksNDz1r7hSfAv2gizr-erWBTu

@apparentlymart

Screencapture: https://drive.google.com/file/d/1RgPYbzyR2HZPgCpFhBpdmHBNLBJcCJ3x/view?usp=sharing

from terraform-plugin-sdk.

ranvijayj avatar ranvijayj commented on June 6, 2024

I think I solved it. In the module main.tf
I had defined this

ebs_block_device {
device_name = "/dev/sda1"
volume_size = "${var.disk_size}"
volume_type = "gp2"
delete_on_termination = false
}

Hope you understand what is wrong in the above piece of code? ^^
So that problem is solved.... 👍

Still worth considering so that output of error is proper. While creating there was no error...

But still getting

Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:
  ~ aws_route_table.r2
      route.1831641277.cidr_block:                "0.0.0.0/0" => ""
      route.1831641277.egress_only_gateway_id:    "" => ""
      route.1831641277.gateway_id:                "" => ""
      route.1831641277.instance_id:               "" => ""
      route.1831641277.ipv6_cidr_block:           "" => ""
      route.1831641277.nat_gateway_id:            "nat-0f404343363f0809f" => ""
      route.1831641277.network_interface_id:      "" => ""
      route.1831641277.vpc_peering_connection_id: "" => ""
      route.825327986.cidr_block:                 "" => "0.0.0.0/0"
      route.825327986.egress_only_gateway_id:     "" => ""
      route.825327986.gateway_id:                 "" => "nat-0f404343363f0809f"
      route.825327986.instance_id:                "" => ""
      route.825327986.ipv6_cidr_block:            "" => ""
      route.825327986.nat_gateway_id:             "" => ""
      route.825327986.network_interface_id:       "" => ""
      route.825327986.vpc_peering_connection_id:  "" => ""

even though nothing is changing in route table after plan and apply.

Here is dev -> config.tf ::: https://drive.google.com/open?id=1__aoVg0ksNDz1r7hSfAv2gizr-erWBTu

Public Subnet

Private Subnet

Definitions

@apparentlymart

from terraform-plugin-sdk.

jbardin avatar jbardin commented on June 6, 2024

@ranvijayj,

Just in case you were attempting to modify the instances, see the final note under the block devices section in the provider docs:

NOTE: Currently, changes to *_block_device configuration of existing resources cannot be automatically detected by Terraform. After making updates to block device configuration, resource recreation can be manually triggered by using the taint command.

If nothing really has changed, and you're on the latest provider release as well, I bet this is a module issue. It looks like that module is trying to map nested data structures to schema elements, which AFAIK just doesn't work (I see you've already files an issue over there as well).

While we're making progress to better support complex data types in the configuration language, assigning schema structures from a variable isn't supported.

from terraform-plugin-sdk.

bflad avatar bflad commented on June 6, 2024

Hi folks 👋 A lot has changed in Terraform CLI and SDK since this issue was raised. If there are still problems on more recent versions of both, please open a new issue and we can take a fresh look. Thanks. 👍

from terraform-plugin-sdk.

github-actions avatar github-actions commented on June 6, 2024

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.

from terraform-plugin-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.