What is the remote-exec provisioner in Terraform

0 votes

Hi Guys,

I have launched one EC2 instance in AWS using Terraform code. Now I want to run commands inside this instance from Terraform. How can I do that?

Jul 23, 2020 in Terraform by akhtar
• 38,220 points
2,528 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use a remote-exec provisioner to do this task in your system. The remote-exec provisioner invokes a script on a remote resource after it is created. This can be used to run a configuration management tool, bootstrap into a cluster, etc. To invoke a local process, see the local-exec provisioner instead.

resource "aws_instance" "web" {
  provisioner "remote-exec" {
    inline = [
       "yum install git",
    ]
  }
}
answered Jul 23, 2020 by MD
• 95,320 points

Related Questions In Terraform

0 votes
1 answer

What is data source in Terraform?

Hi@akhtar, Data sources allow data to be fetched or ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,320 points
716 views
0 votes
1 answer

How does local-exec provisioner work in Terraform?

Hi@akhtar, You can use a local-exec provisioner to ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,320 points
3,590 views
0 votes
2 answers

What is Terraform?

Terraform is a provisioning tool that seems ...READ MORE

answered Aug 29, 2020 in Terraform by nbavis
• 380 points
572 views
0 votes
1 answer

What is a Terraform provider?

Hi@akhtar, Terraform is agnostic to the underlying cloud ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,320 points
250 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,336 views
+2 votes
1 answer
+2 votes
1 answer

What is the difference between modules and workspaces in Terraform?

Hi@akhtar, I think a key difference between Terraform ...READ MORE

answered Aug 17, 2020 in Terraform by MD
• 95,320 points
828 views
0 votes
1 answer

What is the null resource in Terraform?

Hi@akhtar, The null_resource resource implements the standard resource ...READ MORE

answered Sep 29, 2020 in Terraform by MD
• 95,320 points
1,962 views