Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute mismatch error after apply for TypeSet attribute #19934

Closed
kilokahn opened this issue Jan 7, 2019 · 3 comments
Closed

Attribute mismatch error after apply for TypeSet attribute #19934

kilokahn opened this issue Jan 7, 2019 · 3 comments

Comments

@kilokahn
Copy link

kilokahn commented Jan 7, 2019

Terraform Version

v0.11.7

Terraform Configuration Files

variable "tenancy_ocid" {}

variable "user_ocid" {}
variable "fingerprint" {}
variable "private_key_path" {}
variable "compartment_ocid" {}
variable "region" {}

provider "oci" {
  region           = "${var.region}"
  tenancy_ocid     = "${var.tenancy_ocid}"
  user_ocid        = "${var.user_ocid}"
  fingerprint      = "${var.fingerprint}"
  private_key_path = "${var.private_key_path}"
}

resource "oci_core_vcn" "test_vcn" {
  cidr_block     = "10.0.0.0/16"
  compartment_id = "${var.compartment_ocid}"

  display_name = "mubaig-vcn"
}

resource "oci_core_internet_gateway" "test_internet_gateway" {
  compartment_id = "${var.compartment_ocid}"
  display_name   = "mubaig-ig"
  vcn_id         = "${oci_core_vcn.test_vcn.id}"
}

resource "oci_core_route_table" "test_route_table" {
  #Required
  compartment_id = "${var.compartment_ocid}"
  count          = 1

  route_rules {
    network_entity_id = "${lookup(data.oci_core_private_ips.test_private_ips.private_ips[0], "id")}"
    destination = "0.0.0.0/0"
  }

  route_rules {
    network_entity_id = "${lookup(data.oci_core_private_ips.test_private_ips2.private_ips[0], "id")}"
    destination = "160.34.15.48/29"
  }

  route_rules {
    network_entity_id = "${oci_core_internet_gateway.test_internet_gateway.id}"
    destination = "130.35.140.191/32"
  }

  vcn_id = "${oci_core_vcn.test_vcn.id}"

  display_name = "mubaig-route-table"
}

data "oci_identity_availability_domains" "ad" {
  compartment_id = "${var.tenancy_ocid}"
}

resource "oci_core_subnet" "test_subnet" {
  availability_domain = "${lookup(data.oci_identity_availability_domains.ad.availability_domains[0],"name")}"
  cidr_block          = "10.0.1.0/24"
  display_name        = "mubaig-subnet"
  compartment_id      = "${var.compartment_ocid}"
  vcn_id              = "${oci_core_vcn.test_vcn.id}"
}

resource "oci_core_instance" "test_instance" {
  depends_on = ["oci_core_subnet.test_subnet"]
  count      = 2

  availability_domain = "${lookup(data.oci_identity_availability_domains.ad.availability_domains[0], "name")}"
  compartment_id      = "${var.compartment_ocid}"
  display_name        = "mubaig-test-instance"
  shape               = "VM.Standard2.1"

  create_vnic_details {
    subnet_id              = "${oci_core_subnet.test_subnet.id}"
    skip_source_dest_check = "true"
  }

  source_details {
    #Required
    source_id   = "ocid1.image.oc1.phx.aaaaaaaaozjbzisykoybkppaiwviyfzusjzokq7jzwxi7nvwdiopk7ligoia"
    source_type = "image"
  }
}

data "oci_core_private_ips" "test_private_ips" {
  depends_on = ["oci_core_instance.test_instance"]
  subnet_id  = "${element(oci_core_subnet.test_subnet.*.id, 0)}"
  ip_address = "${element(oci_core_instance.test_instance.*.private_ip, 0)}"
}

data "oci_core_private_ips" "test_private_ips2" {
  depends_on = ["oci_core_instance.test_instance"]
  subnet_id  = "${element(oci_core_subnet.test_subnet.*.id, 0)}"
  ip_address = "${element(oci_core_instance.test_instance.*.private_ip, 1)}"
}

Debug Output

https://gist.github.com/kilokahn/77110e1608aeddc5b64d5d10eaca3c77

Crash Output

N/A

Expected Behavior

There should have been no failures in the apply (in fact there shouldn't have been a diff itself)

Actual Behavior

Apply fails

Steps to Reproduce

  1. terraform init
  2. terraform plan
  3. terraform apply
  4. terraform plan # this should be empty, but it isn't
  5. terraform apply # this fails

Additional Context

When multiple route_rules are present, terraform's state diff comparison seems to be failing.

References

A related issue for the unnecessary change in plan is logged in #19933

@kilokahn
Copy link
Author

kilokahn commented Jan 8, 2019

Since the original problem of the #19933 spurious plan diff is solved, this becomes somewhat irrelevant. I will leave it up to you to see if this needs any investigation.

@mildwonkey
Copy link
Contributor

Thanks @kilokahn , I'll close this as also a duplicate - thank you for opening the issues, and updating this one!

Duplicate of #18600

@ghost
Copy link

ghost commented Mar 30, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants