Skip to content

Commit 02a59b9

Browse files
committed
Fix multiline heredoc text in description
1 parent 31623c5 commit 02a59b9

File tree

12 files changed

+83
-1
lines changed

12 files changed

+83
-1
lines changed

data/terraform-docs.awk

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@
4848
blockDefaultCnt += gsub(/\(/, "")
4949
blockDefaultCnt += gsub(/\[/, "")
5050
blockDefaultCnt += gsub(/\{/, "")
51+
blockDefaultCnt += gsub(/\<\<EOF/, "")
5152
# Count closing blocks
5253
blockDefaultCnt -= gsub(/\)/, "")
5354
blockDefaultCnt -= gsub(/\]/, "")
5455
blockDefaultCnt -= gsub(/\}/, "")
56+
blockDefaultCnt -= gsub(/EOF/, "")
5557
}
5658
# [START] multiline "default" statement started
5759
if (blockCnt > 0 && blockTypeCnt == 0 && blockDefaultCnt == 0) {
@@ -64,10 +66,12 @@
6466
blockDefaultCnt += gsub(/\(/, "")
6567
blockDefaultCnt += gsub(/\[/, "")
6668
blockDefaultCnt += gsub(/\{/, "")
69+
blockDefaultCnt += gsub(/\<\<EOF/, "")
6770
# Count closing blocks
6871
blockDefaultCnt -= gsub(/\)/, "")
6972
blockDefaultCnt -= gsub(/\]/, "")
7073
blockDefaultCnt -= gsub(/\}/, "")
74+
blockDefaultCnt -= gsub(/EOF/, "")
7175
}
7276
}
7377
}
@@ -128,10 +132,21 @@
128132
# ----------------------------------------------------------------------------------------------
129133
# description = ...
130134
# ----------------------------------------------------------------------------------------------
131-
# [PRINT] single line "description"
135+
# [END] multiline "description" continues/ends
136+
if (blockCtn > 0 && blockTypeCnt == 0 && blockDefaultCnt == 0) {
137+
# Count opening blocks
138+
blockDefaultCnt += gsub(/\<\<EOF/, "")
139+
# Count closing blocks
140+
blockDefaultCnt -= gsub(/EOF/, "")
141+
}
142+
# [START] multiline "description" statement started
132143
if (blockCnt > 0 && blockTypeCnt == 0 && blockDefaultCnt == 0) {
133144
if ($0 ~ /^[[:space:]][[:space:]]*description[[:space:]][[:space:]]*=/) {
134145
print $0
146+
# Count opening blocks
147+
blockDefaultCnt += gsub(/\<\<EOF/, "")
148+
# Count closing blocks
149+
blockDefaultCnt -= gsub(/EOF/, "")
135150
}
136151
}
137152

tests/0.12/TEST-0.1.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ Stuff before terraform-docs
100100
| storage_encrypted | Specifies whether the DB instance is encrypted | `false` | no |
101101
| storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | `gp2` | no |
102102
| subnet_ids | A list of VPC subnet IDs | `<list>` | no |
103+
| subnetwork | This is a test | `This
104+
is
105+
a
106+
test
107+
` | no |
103108
| tags | A mapping of tags to assign to all resources | `<map>` | no |
104109
| test_var | This is a test variable | `` | no |
105110
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | `<map>` | no |

tests/0.12/TEST-0.1.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ Stuff before terraform-docs
100100
| storage_encrypted | Specifies whether the DB instance is encrypted | bool | `false` | no |
101101
| storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `gp2` | no |
102102
| subnet_ids | A list of VPC subnet IDs | list(string) | `<list>` | no |
103+
| subnetwork | This is a test | string | `This
104+
is
105+
a
106+
test
107+
` | no |
103108
| tags | A mapping of tags to assign to all resources | map(string) | `<map>` | no |
104109
| test_var | This is a test variable | string | `` | no |
105110
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `<map>` | no |

tests/0.12/TEST-0.2.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ Stuff before terraform-docs
100100
| storage_encrypted | Specifies whether the DB instance is encrypted | bool | `false` | no |
101101
| storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `gp2` | no |
102102
| subnet_ids | A list of VPC subnet IDs | list(string) | `<list>` | no |
103+
| subnetwork | This is a test | string | `This
104+
is
105+
a
106+
test
107+
` | no |
103108
| tags | A mapping of tags to assign to all resources | map(string) | `<map>` | no |
104109
| test_var | This is a test variable | string | `` | no |
105110
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `<map>` | no |

tests/0.12/TEST-0.3.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Stuff before terraform-docs
100100
| storage_encrypted | Specifies whether the DB instance is encrypted | bool | `false` | no |
101101
| storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `gp2` | no |
102102
| subnet_ids | A list of VPC subnet IDs | list(string) | `<list>` | no |
103+
| subnetwork | This is a test | string | `This is a test ` | no |
103104
| tags | A mapping of tags to assign to all resources | map(string) | `<map>` | no |
104105
| test_var | This is a test variable | string | `` | no |
105106
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `<map>` | no |

tests/0.12/TEST-0.4.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ Stuff before terraform-docs
100100
| storage_encrypted | Specifies whether the DB instance is encrypted | bool | `false` | no |
101101
| storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `gp2` | no |
102102
| subnet_ids | A list of VPC subnet IDs | list(string) | `[]` | no |
103+
| subnetwork | This is a test | string | `This
104+
is
105+
a
106+
test
107+
` | no |
103108
| tags | A mapping of tags to assign to all resources | map(string) | `{}` | no |
104109
| test_var | This is a test variable | string | `` | no |
105110
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `{ "create": "40m", "delete": "40m", "update": "80m" }` | no |

tests/0.12/TEST-0.4.5.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ Stuff before terraform-docs
9999
| storage_encrypted | Specifies whether the DB instance is encrypted | bool | `false` | no |
100100
| storage_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `gp2` | no |
101101
| subnet_ids | A list of VPC subnet IDs | list(string) | `[]` | no |
102+
| subnetwork | This is a test | string | `This
103+
is
104+
a
105+
test
106+
` | no |
102107
| tags | A mapping of tags to assign to all resources | map(string) | `{}` | no |
103108
| test_var | This is a test variable | string | `` | no |
104109
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `{ "create": "40m", "delete": "40m", "update": "80m" }` | no |

tests/0.12/TEST-0.5.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ Stuff before terraform-docs
101101
| storage\_encrypted | Specifies whether the DB instance is encrypted | bool | `false` | no |
102102
| storage\_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `gp2` | no |
103103
| subnet\_ids | A list of VPC subnet IDs | list(string) | `[]` | no |
104+
| subnetwork | This is a test | string | `This
105+
is
106+
a
107+
test
108+
` | no |
104109
| tags | A mapping of tags to assign to all resources | map(string) | `{}` | no |
105110
| test\_var | This is a test variable | string | `` | no |
106111
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `{ "create": "40m", "delete": "40m", "update": "80m" }` | no |

tests/0.12/TEST-0.6.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Stuff before terraform-docs
101101
| storage\_encrypted | Specifies whether the DB instance is encrypted | bool | `"false"` | no |
102102
| storage\_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `"gp2"` | no |
103103
| subnet\_ids | A list of VPC subnet IDs | list(string) | `[]` | no |
104+
| subnetwork | This is a test | string | `"This\nis\na\ntest\n"` | no |
104105
| tags | A mapping of tags to assign to all resources | map(string) | `{}` | no |
105106
| test\_var | This is a test variable | string | `""` | no |
106107
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws_db_instance` in particular to permit resource management times | map(string) | `{ "create": "40m", "delete": "40m", "update": "80m" }` | no |

tests/0.12/TEST-0.7.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Stuff before terraform-docs
101101
| storage\_encrypted | Specifies whether the DB instance is encrypted | bool | `"false"` | no |
102102
| storage\_type | One of 'standard' \(magnetic\), 'gp2' \(general purpose SSD\), or 'io1' \(provisioned IOPS SSD\). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | string | `"gp2"` | no |
103103
| subnet\_ids | A list of VPC subnet IDs | list(string) | `[]` | no |
104+
| subnetwork | This is a test | string | `"This\nis\na\ntest\n"` | no |
104105
| tags | A mapping of tags to assign to all resources | map(string) | `{}` | no |
105106
| test\_var | This is a test variable | string | `""` | no |
106107
| timeouts | \(Optional\) Updated Terraform resource management timeouts. Applies to `aws\_db\_instance` in particular to permit resource management times | map(string) | `{ "create": "40m", "delete": "40m", "update": "80m" }` | no |

tests/0.12/TEST-latest.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ No provider.
103103
| storage\_encrypted | Specifies whether the DB instance is encrypted | `bool` | `false` | no |
104104
| storage\_type | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'standard' if not. Note that this behaviour is different from the AWS web console, where the default is 'gp2'. | `string` | `"gp2"` | no |
105105
| subnet\_ids | A list of VPC subnet IDs | `list(string)` | `[]` | no |
106+
| subnetwork | This is a test | `string` | `"This\nis\na\ntest\n"` | no |
106107
| tags | A mapping of tags to assign to all resources | `map(string)` | `{}` | no |
107108
| test\_var | This is a test variable | `string` | `""` | no |
108109
| timeouts | (Optional) Updated Terraform resource management timeouts. Applies to `aws\_db\_instance` in particular to permit resource management times | `map(string)` | <code><pre>{<br> "create": "40m",<br> "delete": "40m",<br> "update": "80m"<br>}<br></pre></code> | no |

tests/0.12/main.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,39 @@ output "environment" {
5151
}
5252
}
5353

54+
###################################################################################################
55+
#
56+
# multi-line patch (https://github.com/cytopia/build-harness/pull/1)
57+
#
58+
###################################################################################################
59+
60+
variable "subnetwork" {
61+
type = string
62+
63+
default = <<EOF
64+
This
65+
is
66+
a
67+
test
68+
EOF
69+
70+
description = <<EOF
71+
This
72+
is
73+
a
74+
test
75+
EOF
76+
77+
value = <<EOF
78+
This
79+
is
80+
a
81+
test
82+
EOF
83+
84+
}
85+
86+
5487
###################################################################################################
5588
#
5689
# "%" in default value (https://github.com/cytopia/docker-terraform-docs/issues/24)

0 commit comments

Comments
 (0)