Fix: improve unit test coverage for ProvisionerBlock decode (#1324)

Signed-off-by: Syasusu <syasusu@163.com>
This commit is contained in:
Syasusu 2024-03-13 18:45:45 +01:00 committed by GitHub
parent 8d2216d24b
commit e25c06c673
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,9 @@
resource "null_resource" "a" {
provisioner "local-exec" {
connection {}
connection {} # ERROR: Duplicate connection block
_ {}
_ {} # ERROR: Duplicate escaping block
}
}

View 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
}
}