@@ -51,11 +51,12 @@ Prior to making configuration changes, it is strongly recommended that configura
5151
5252The following describes cases where it is possible to convert existing v0.11 usage to be compatible with both v0.11 and v0.12.
5353
54- ##### Attributes vs. Blocks
54+ #### Attributes vs. Blocks
5555In v0.11, it was possible to treat attributes and nested blocks interchangeably.
5656Note how the attribute ` metadata ` and the nested block ` source_details ` are both assigned using only braces.
57+
5758``` hcl
58- # v0.11 compatible representation
59+ // v0.11 compatible representation
5960resource "oci_core_instance" "my_instance" {
6061 metadata {
6162 ssh_authorized_keys = "${var.ssh_public_key}"
@@ -71,8 +72,9 @@ resource "oci_core_instance" "my_instance" {
7172
7273In v0.12, attributes need to be assigned using the ` = ` operator while blocks need to be assigned using only braces.
7374Note how the attribute ` metadata ` is now assigned with ` = ` . This usage is still compatible with v0.11.
75+
7476``` hcl
75- # v0.12 and v0.11 compatible representation
77+ // v0.12 and v0.11 compatible representation
7678resource "oci_core_instance" "my_instance" {
7779 metadata = {
7880 ssh_authorized_keys = "${var.ssh_public_key}"
@@ -85,10 +87,11 @@ resource "oci_core_instance" "my_instance" {
8587 }
8688```
8789
88- ##### Nested blocks with multiple elements
90+ #### Nested blocks with multiple elements
8991In v0.11, it was possible to wrap lists of nested blocks inside ` [] ` like this example.
92+
9093``` hcl
91- # v0.11 compatible representation
94+ // v0.11 compatible representation
9295resource "oci_core_virtual_circuit" "virtual_circuit_public" {
9396 public_prefixes = [
9497 {
@@ -108,8 +111,9 @@ resource "oci_core_virtual_circuit" "virtual_circuit_public" {
108111
109112In v0.12, it is required to specify each nested block individually without wrapping it in ` [] ` .
110113This usage is still compatible with v0.11.
114+
111115``` hcl
112- # v0.11 compatible representation
116+ // v0.11 compatible representation
113117resource "oci_core_virtual_circuit" "virtual_circuit_public" {
114118 public_prefixes {
115119 cidr_block = "${var.virtual_circuit_public_prefixes_cidr_block}"
@@ -125,11 +129,12 @@ resource "oci_core_virtual_circuit" "virtual_circuit_public" {
125129}
126130```
127131
128- ##### Quotes around attribute names
132+ #### Quotes around attribute names
129133In v0.11, it was possible to put quotation marks ` " ` around attribute names.
130134Note how the ` min ` and ` max ` attributes have quotation marks around them.
135+
131136``` hcl
132- # v0.11 compatible representation
137+ // v0.11 compatible representation
133138resource "oci_core_security_list" "bastion" {
134139 egress_security_rules {
135140 destination = "${var.vcn_cidr}"
@@ -146,8 +151,9 @@ resource "oci_core_security_list" "bastion" {
146151```
147152
148153In v0.12, quotation marks ` " ` around attribute names are no longer allowed.
154+
149155``` hcl
150- # v0.11 and v0.12 compatible representation
156+ // v0.11 and v0.12 compatible representation
151157resource "oci_core_security_list" "bastion" {
152158 egress_security_rules {
153159 destination = "${var.vcn_cidr}"
@@ -163,33 +169,37 @@ resource "oci_core_security_list" "bastion" {
163169}
164170```
165171
166- ##### Variable names starting with non-alphabetical characters
172+ #### Variable names starting with non-alphabetical characters
167173In v0.11, it was possible to specify variable names that begin with non-alphabetical characters.
174+
168175``` hcl
169- # v0.11 compatible representation
176+ // v0.11 compatible representation
170177variable "2TB" {
171178 default = "2048"
172179}
173180```
174181
175182In v0.12, variable names must begin with alphabetical characters.
183+
176184``` hcl
177- # v0.11 and v0.12 compatible representation
185+ // v0.11 and v0.12 compatible representation
178186variable "Size2TB" {
179187 default = "2048"
180188}
181189```
182190
183- ##### Computing list index values
191+ #### Computing list index values
184192In v0.11, division operations often resulted in integer values that could be used as a valid index in a list.
193+
185194``` hcl
186- # v0.11 compatible representation
195+ // v0.11 compatible representation
187196instance_id = "${oci_core_instance.TFInstance.*.id[count.index / var.NumParavirtualizedVolumesPerInstance]}"
188197```
189198
190199In v0.12, division operations can result in floating point values that may no longer be valid.
191200To avoid this situation, use the ` floor ` interpolation to convert floating point values to an index.
201+
192202``` hcl
193- # v0.11 and v0.12 compatible representation
203+ // v0.11 and v0.12 compatible representation
194204instance_id = "${oci_core_instance.TFInstance.*.id[floor(count.index / var.NumParavirtualizedVolumesPerInstance)]}"
195205```
0 commit comments