mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Fix: improve unit test coverage for ProvisionerBlock decode (#1324)
Signed-off-by: Syasusu <syasusu@163.com>
This commit is contained in:
parent
8d2216d24b
commit
e25c06c673
@ -10,6 +10,7 @@ resource "null_resource" "a" {
|
|||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
when = destroy
|
when = destroy
|
||||||
|
on_failure = continue
|
||||||
index = count.index
|
index = count.index
|
||||||
key = each.key
|
key = each.key
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ resource "null_resource" "b" {
|
|||||||
resource "null_resource" "b" {
|
resource "null_resource" "b" {
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
when = destroy
|
when = destroy
|
||||||
|
on_failure = fail
|
||||||
connection {
|
connection {
|
||||||
host = self.hostname
|
host = self.hostname
|
||||||
user = local.user # ERROR: Invalid reference from destroy provisioner
|
user = local.user # ERROR: Invalid reference from destroy provisioner
|
||||||
|
9
internal/configs/testdata/error-files/duplicate-block-in-provisioner.tf
vendored
Normal file
9
internal/configs/testdata/error-files/duplicate-block-in-provisioner.tf
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
resource "null_resource" "a" {
|
||||||
|
provisioner "local-exec" {
|
||||||
|
connection {}
|
||||||
|
connection {} # ERROR: Duplicate connection block
|
||||||
|
|
||||||
|
_ {}
|
||||||
|
_ {} # ERROR: Duplicate escaping block
|
||||||
|
}
|
||||||
|
}
|
7
internal/configs/testdata/error-files/invalid-keyword-in-provisioner.tf
vendored
Normal file
7
internal/configs/testdata/error-files/invalid-keyword-in-provisioner.tf
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
resource "null_resource" "a" {
|
||||||
|
provisioner "local-exec" {
|
||||||
|
when = invalid # ERROR: Invalid "when" keyword
|
||||||
|
on_failure = invalid # ERROR: Invalid "on_failure" keyword
|
||||||
|
lifecycle {} # ERROR: Reserved block type name in provisioner block
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user