``` for code block

This commit is contained in:
gregory hendrickson
2023-11-15 14:19:51 -08:00
parent bc713b7ad3
commit 6bfd1133c7

View File

@@ -436,20 +436,24 @@ Alternatives to Provisioners:
* environment (optional)
* A map of environment variables to set prior to execution. This is useful for passing secret values to scripts.
```
resource "aws_instance" "web" {
# ...
provisioner "local-exec" {
command = "echo ${aws_instance.web.private_ip} >> private_ips.txt"
}
}
```
```
resource "null_resource" "example2" {
provisioner "local-exec" {
command = "Get-Date > completed.txt"
interpreter = ["PowerShell", "-Command"]
}
}
```
```
resource "aws_instance" "web" {
# ...
provisioner "local-exec" {
@@ -461,6 +465,7 @@ Alternatives to Provisioners:
}
}
}
```
## Remote-Exec
* Remote-Exec allows you to execute commands on a target resource after a resource is provisioned