Terraform Provisioner Example in Cloud

Terraform Provisioners can be used to execute specific actions on the local machine or on a remote machine.

After we build our infrastructure in AWS we need to execute certain actions which may be a command or may be a script or any config management tools.

Here I will show an example of using 3 different kind of provisioners while creating an instance.

1. remote-exec = To invoke a command/script on a remote machine
2. local-exec = To invoke a local executable command/script after resource creation
3. file = Used to copy files or directories from the machine executing Terraform to the newly created resource using ssh or winrm

Code can be found here :

Leave a Reply