Created
May 7, 2019 09:20
-
-
Save falzm/18d7b38fec3303cfbba8837adceb245c to your computer and use it in GitHub Desktop.
Terraform sample configuration illustrating a bug with targeted "destroy" command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This example uses the Exoscale provider: | |
# https://github.com/exoscale/terraform-provider-exoscale/ | |
locals { | |
zone = "ch-gva-2" | |
key_pair = "default" | |
hostnames = [ | |
"ch2771-test1", | |
"ch2771-test2", | |
"ch2771-test3", | |
] | |
} | |
resource "exoscale_network" "privnet" { | |
zone = "${local.zone}" | |
name = "ch2771" | |
network_offering = "PrivNet" | |
} | |
resource "exoscale_compute" "machine" { | |
count = "${length(local.hostnames)}" | |
zone = "${local.zone}" | |
display_name = "${element(local.hostnames, count.index)}" | |
size = "Micro" | |
disk_size = "10" | |
template = "Linux Ubuntu 18.04 LTS 64-bit" | |
key_pair = "${local.key_pair}" | |
} | |
resource "exoscale_nic" "machine" { | |
count = "${length(local.hostnames)}" | |
compute_id = "${exoscale_compute.machine.*.id[count.index]}" | |
network_id = "${exoscale_network.privnet.id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem: when trying to destroy one of the
exoscale_compute
instances using the-target
option, all theexoscale_nic
resources would be destroyed by Terraform although only the one corresponding to the targeted instance should: