Complete the code to specify the provisioner that runs a script on the resource.
resource "null_resource" "example" { provisioner "[1]" { script = "setup.sh" } }
The local-exec provisioner runs a command locally on the machine running Terraform.
Complete the code to make Terraform continue even if the provisioner fails.
resource "null_resource" "example" { provisioner "local-exec" { command = "exit 1" [1] = true } }
The ignore_errors argument tells Terraform to continue even if the provisioner command fails.
Fix the error in the provisioner block to correctly handle failure behavior.
resource "null_resource" "example" { provisioner "local-exec" { command = "exit 1" ignore_errors = [1] } }
The ignore_errors argument expects a boolean value true or false, not a string or number.
Fill both blanks to configure a remote-exec provisioner that retries on failure.
resource "null_resource" "example" { provisioner "remote-exec" { inline = ["echo Hello"] [1] = 3 [2] = 10 } }
max_retries sets how many times Terraform retries the provisioner on failure, and retry_delay_sec sets the delay in seconds between retries.
Fill all three blanks to define a provisioner that uploads a file and ignores failure.
resource "null_resource" "example" { provisioner "file" { source = "app.zip" destination = "/tmp/app.zip" [1] = "ubuntu" [2] = "/home/ubuntu/.ssh/id_rsa" [3] = true } }
The user specifies the SSH user, private_key specifies the SSH key path, and ignore_errors allows Terraform to continue if the provisioner fails.