Complete the code to define a null_resource with a local-exec provisioner.
resource "null_resource" "example" { provisioner "local-exec" { command = [1] } }
The command must be a string, so it needs quotes around it.
Complete the code to add a remote-exec provisioner that runs a shell command.
resource "null_resource" "example" { provisioner "remote-exec" { inline = [1] } }
The inline argument expects a list of strings, so it must be wrapped in square brackets and quotes.
Fix the error in the provisioner block by completing the missing argument.
resource "null_resource" "example" { provisioner "remote-exec" { connection { type = [1] user = "ubuntu" host = self.private_ip } inline = ["echo Hello"] } }
The connection type for remote-exec on Linux machines is usually SSH.
Fill both blanks to correctly configure a null_resource with triggers and a local-exec provisioner.
resource "null_resource" "example" { triggers = { always_run = [1] } provisioner "local-exec" { command = [2] } }
Using timestamp() in triggers forces the resource to run every time. The command must be a quoted string.
Fill all three blanks to create a remote-exec provisioner with SSH connection and inline commands.
resource "null_resource" "example" { connection { type = [1] user = [2] host = self.public_ip } provisioner "remote-exec" { inline = [[3]] } }
SSH is the connection type, 'ubuntu' is the user, and the inline command must be a quoted string inside a list.