{"action":"opened","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/8781","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/8781/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/8781/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/8781/events","html_url":"https://github.com/hashicorp/terraform/issues/8781","id":176303782,"number":8781,"title":"tls_locally_signed_cert forces recreating resources when count changes","user":{"login":"RichardKnop","id":2325888,"avatar_url":"https://avatars.githubusercontent.com/u/2325888?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardKnop","html_url":"https://github.com/RichardKnop","followers_url":"https://api.github.com/users/RichardKnop/followers","following_url":"https://api.github.com/users/RichardKnop/following{/other_user}","gists_url":"https://api.github.com/users/RichardKnop/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardKnop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardKnop/subscriptions","organizations_url":"https://api.github.com/users/RichardKnop/orgs","repos_url":"https://api.github.com/users/RichardKnop/repos","events_url":"https://api.github.com/users/RichardKnop/events{/privacy}","received_events_url":"https://api.github.com/users/RichardKnop/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-12T06:36:56Z","updated_at":"2016-09-12T06:36:56Z","closed_at":null,"body":"So, let's say I use count meta-param to create several locally signed certificates:\r\n\r\n```\r\nresource \"tls_cert_request\" \"server\" {\r\n  count = \"2\"\r\n  key_algorithm = \"${element(tls_private_key.server.*.algorithm, count.index)}\"\r\n  private_key_pem = \"${element(tls_private_key.server.*.private_key_pem, count.index)}\"\r\n\r\n  subject {\r\n    common_name = \"coreos${count.index}\"\r\n    organization = \"My company\"\r\n    country = \"UK\"\r\n  }\r\n\r\n  dns_names = [\r\n    # hostname\r\n    \"coreos${count.index}\",\r\n  ]\r\n}\r\n```\r\n\r\nWhen running `plan` command after increasing the count (from `2` to let's say `3`), all `tls_locally_signed_cert` resources are considered to be changed.\r\n\r\n### Terraform Version\r\n\r\n```\r\nTerraform v0.7.4-dev (291f2985354454749e3e6da586c1ecd5d245c181)\r\n```\r\n\r\n### Affected Resource(s)\r\n\r\n- `tls_locally_signed_cert`\r\n\r\n### Debug Output\r\n\r\n```\r\n-/+ module.cluster.tls_cert_request.client_server.0\r\n    cert_request_pem:       \"-----BEGIN CERTIFICATE REQUEST-----\\n ... \\n-----END CERTIFICATE REQUEST-----\\n\" => \"<computed>\"\r\n    dns_names.#:            \"2\" => \"2\"\r\n    dns_names.0:            \"10.0.1.10\" => \"10.0.1.10\"\r\n    dns_names.1:            \"coreos0\" => \"coreos0\"\r\n    key_algorithm:          \"ECDSA\" => \"ECDSA\"\r\n    private_key_pem:        \"e6983a65e7c549f06a100867e11d36f25f673dc2\" => \"9ad8b3163b59f6437f32ee6202b76c66a8887ef0\" (forces new resource)\r\n    subject.#:              \"1\" => \"1\"\r\n    subject.0.common_name:  \"coreos0\" => \"coreos0\"\r\n    subject.0.country:      \"UK\" => \"UK\"\r\n    subject.0.organization: \"My company\" => \"My company\"\r\n```\r\n\r\n### Expected Behavior\r\n\r\nWhen I increase the count of `tls_locally_signed_cert` from `2` to `3`, the existing two certificate requests should be considered unchanged and only one new created.\r\n\r\n### Actual Behavior\r\n\r\nWhen I increase the count of `tls_locally_signed_cert` from `2` to `3`, the two certificate requests are considered changed and force recreation of resources.\r\n\r\n### Steps to Reproduce\r\n\r\n1. `terraform apply` with `tls_locally_signed_cert` with count set to `2`\r\n2. Increase count to `3`\r\n2. `terraform plan`"}}
{"actor":{"display_login":"RichardKnop"}}