How to import module in Terraform code

0 votes

Hi Guys,

I have one Terraform code. In this code, I want to import one module from another file. How can I do that?

Jul 21, 2020 in Terraform by akhtar
• 38,180 points
770 views

1 answer to this question.

0 votes

Hi@akhtar,

A module is a container for multiple resources that are used together. Every Terraform configuration has at least one module, known as its root module, which consists of the resources defined in the .tf files in the main working directory. To call a module means to include the contents of that module into the configuration with specific values for its input variables. Modules are called from within other modules using module blocks.

module "servers" {
  source = "./app-cluster"
}
answered Jul 21, 2020 by MD
• 95,220 points

Related Questions In Terraform

0 votes
1 answer

How to add a route for IGW in AWS using Terraform code?

Hi@akhtar, Terraform has one keyword named route. It allows ...READ MORE

answered Jul 22, 2020 in Terraform by MD
• 95,220 points
501 views
0 votes
1 answer

How to create an EFS in AWS from Terraform Code?

Hi@MD, You can use aws_efs_file_system resource in Terraform. ...READ MORE

answered Sep 9, 2020 in Terraform by akhtar
• 38,180 points
316 views
0 votes
1 answer

How to import manually created s3 bucket in Terraform?

Hi@akhtar, Terraform will not able to get the ...READ MORE

answered Sep 10, 2020 in Terraform by MD
• 95,220 points
2,003 views
0 votes
1 answer

How to create a VPC in GCP Cloud using Terraform code?

Hi@akhtar, You can create your own VPC in ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,220 points
459 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,135 views
+2 votes
1 answer
0 votes
1 answer

How to create a route table in AWS using Terraform code?

Hi@akhtar, You can use aws_route_table resources in your ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,220 points
1,032 views
0 votes
1 answer

How to attach Elastic IP in EC2 instance using Terraform code?

Hi@akhtar, You can use aws_eip resource in your ...READ MORE

answered Jul 22, 2020 in Terraform by MD
• 95,220 points
3,908 views