terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

terraform ibm_is_instance_template volume_attachments removal from configuration not changing resource

Open powellquiring opened this issue 2 years ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

bug-is-instance-template $ tf version
Terraform v1.1.9
on darwin_amd64
+ provider registry.terraform.io/ibm-cloud/ibm v1.44.2

Your version of Terraform is out of date! The latest version
is 1.2.7. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • ibm_is_instance_template

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "ibm_is_instance_template" "instance_template" {
  name           = "${var.prefix}-template"
  image          = data.ibm_is_image.os.id
  profile        = "cx2-2x4"
  resource_group = local.resource_group

  primary_network_interface {
    subnet = ibm_is_subnet.front.id
  }
  vpc  = ibm_is_vpc.location.id
  zone = local.zone
  keys = [data.ibm_is_ssh_key.sshkey.id]

  lifecycle {
    create_before_destroy = true
  }
  /*
  terraform apply
  remove the volume_attachments below:
  terraform apply
  */
  volume_attachments {
    delete_volume_on_instance_delete = true
    name                             = "${var.prefix}-template-volume-attachment"
    volume_prototype {
      profile  = "general-purpose"
      capacity = 200
    }
  }
}

Expected Behavior

Apply would delete the volume_attachments from the ibm_is_instance_template resource after removing from the configuration.

Actual Behavior

Nothing happened:

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
bug-is-instance-template $ tfa
ibm_is_vpc.location: Refreshing state... [id=r006-f1d066db-5212-4d19-8759-6f352e5accbe]
ibm_is_vpc_address_prefix.locations: Refreshing state... [id=r006-f1d066db-5212-4d19-8759-6f352e5accbe/r006-b3f346f0-9df0-4181-aea4-7a5586c3d9a3]
ibm_is_subnet.back: Refreshing state... [id=0717-9898cd65-591f-4671-a824-446bfcc122c7]
ibm_is_subnet.front: Refreshing state... [id=0717-cdf91753-b84f-4b59-bc2c-5bed86d7f4a7]
ibm_is_instance_template.instance_template: Refreshing state... [id=0717-83b363f9-2440-4a66-8f77-4b465646718a]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are
needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Steps to Reproduce

Source is here: https://github.com/powellquiring/tfbugs/tree/master/bug-is-instance-template

git clone [email protected]:powellquiring/tfbugs.git
cd tfbugs/bug-is-instance-template
  1. terraform init
  2. terraform apply
  3. remove the volume_attachments below:
  4. terraform apply

References

powellquiring avatar Aug 12 '22 17:08 powellquiring