From 531092f86b95f7fe02ae0d9200018b5d42ada80a Mon Sep 17 00:00:00 2001 From: Alex Ng Date: Mon, 6 May 2019 18:01:25 -0700 Subject: [PATCH 1/2] v0.12 preparation: Fix metadata usage to be canonical Fields such as "metadata" which are map types should be assigned with "=" operators. Without this change, this module will result in syntax errors in v0.12. --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index f003cb0..90a514f 100644 --- a/main.tf +++ b/main.tf @@ -30,7 +30,7 @@ resource "oci_core_instance" "this" { subnet_id = "${data.oci_core_subnet.this.*.id[count.index % length(data.oci_core_subnet.this.*.id)]}" } - metadata { + metadata = { ssh_authorized_keys = "${file("${var.ssh_authorized_keys}")}" user_data = "${var.user_data}" } From eb2950de1b2249a70066cd0a1821c6c4c324467b Mon Sep 17 00:00:00 2001 From: Alex Ng Date: Tue, 7 May 2019 16:38:19 -0700 Subject: [PATCH 2/2] Fix index computation so that whole value is the result of division In v0.12, division operations will result in floating point values that are invalid list index values. Use "floor" to convert them to valid index values. --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 90a514f..aee1fe6 100644 --- a/main.tf +++ b/main.tf @@ -61,8 +61,8 @@ resource "oci_core_volume" "this" { count = "${var.instance_count * length(var.block_storage_sizes_in_gbs)}" availability_domain = "${oci_core_instance.this.*.availability_domain[count.index % var.instance_count]}" compartment_id = "${var.compartment_ocid}" - display_name = "${oci_core_instance.this.*.display_name[count.index % var.instance_count]}_volume${count.index / var.instance_count}" - size_in_gbs = "${element(var.block_storage_sizes_in_gbs, count.index / var.instance_count)}" + display_name = "${oci_core_instance.this.*.display_name[count.index % var.instance_count]}_volume${floor(count.index / var.instance_count)}" + size_in_gbs = "${element(var.block_storage_sizes_in_gbs, floor(count.index / var.instance_count))}" } ####################