Skip to content

Commit 00924ed

Browse files
Merge pull request #780 from terraform-providers/alexng/v12_compat
Fix formatting of v12 upgrade guide so it renders correctly on `terra…
2 parents 2a1f5f1 + 8b02a01 commit 00924ed

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

website/docs/guides/terraform_version_12_upgrade.html.markdown

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ Prior to making configuration changes, it is strongly recommended that configura
5151

5252
The 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
5555
In v0.11, it was possible to treat attributes and nested blocks interchangeably.
5656
Note 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
5960
resource "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

7273
In v0.12, attributes need to be assigned using the `=` operator while blocks need to be assigned using only braces.
7374
Note 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
7678
resource "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
8991
In 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
9295
resource "oci_core_virtual_circuit" "virtual_circuit_public" {
9396
public_prefixes = [
9497
{
@@ -108,8 +111,9 @@ resource "oci_core_virtual_circuit" "virtual_circuit_public" {
108111

109112
In v0.12, it is required to specify each nested block individually without wrapping it in `[]`.
110113
This usage is still compatible with v0.11.
114+
111115
```hcl
112-
# v0.11 compatible representation
116+
// v0.11 compatible representation
113117
resource "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
129133
In v0.11, it was possible to put quotation marks `"` around attribute names.
130134
Note how the `min` and `max` attributes have quotation marks around them.
135+
131136
```hcl
132-
# v0.11 compatible representation
137+
// v0.11 compatible representation
133138
resource "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

148153
In 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
151157
resource "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
167173
In 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
170177
variable "2TB" {
171178
default = "2048"
172179
}
173180
```
174181

175182
In 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
178186
variable "Size2TB" {
179187
default = "2048"
180188
}
181189
```
182190

183-
##### Computing list index values
191+
#### Computing list index values
184192
In 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
187196
instance_id = "${oci_core_instance.TFInstance.*.id[count.index / var.NumParavirtualizedVolumesPerInstance]}"
188197
```
189198

190199
In v0.12, division operations can result in floating point values that may no longer be valid.
191200
To 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
194204
instance_id = "${oci_core_instance.TFInstance.*.id[floor(count.index / var.NumParavirtualizedVolumesPerInstance)]}"
195205
```

0 commit comments

Comments
 (0)