Questions tagged [terraform-modules]
156 questions
76
votes
6 answers
Terraform - refactoring modules: Error: Provider configuration not present
I'm refactoring some Terraform modules and am getting:
Error: Provider configuration not present
To work with
module.my_module.some_resource.resource_name its
original provider configuration at
module.my_module.provider.some_provider.provider_name…

Snowcrash
- 80,579
- 89
- 266
- 376
25
votes
4 answers
Terraform module - output variable as input for another module
I am new to terraform and trying to build an infrastructure with two subnets and VPC. I have created two modules
VPC
subnet
The VPC module will create a VPC and will return vpc_id as output, the same return vpc_id I am trying to use in the subnet…

Mahesh
- 296
- 1
- 3
- 4
16
votes
2 answers
Conditionally create a single module in Terraform
I have been trying to conditionally use a module from the root module, so that for certain environments this module is not created. Many people claim that by setting the count in the module to either 0 or 1 using a conditional does the trick.
module…

ccoutinho
- 3,308
- 5
- 39
- 47
8
votes
1 answer
Terraform: can I pass ignore_changes to the module?
Can I pass ignore_changes to the terraform module?
In my case, I do not want to update the autoscaling group, when AMI was updated.
After a brief review, it seems that it cannot be done - https://github.com/hashicorp/terraform/issues/21546
Of…

mva
- 384
- 1
- 5
- 12
8
votes
3 answers
Module directory does not exist or cannot be read in Terraform
I am trying to use Modules for dependencies in my Terraform code. But even after mentioning that particular source path in module, it gives an error “ Module directory does not exist or cannot be read." and “Unable to evaluate directory – The…

SiddhiMorajkar
- 395
- 4
- 7
- 18
6
votes
1 answer
terraform import an existing AWS resource to a module
I have got an AWS account that already has ECR and IAM ready. I am now creating a new environment using terraform modules. But I could not find a way to import the existing IAM and ECR resources to my modules. When I run the command terraform import…

Alla Sasikanth
- 541
- 3
- 7
- 22
6
votes
2 answers
terraform overwrite tag value in sub modules
I'm using terraform modules and passing a set of default_tags to sub-modules for consistent tagging. This is shown below, and has the advantage that sub-modules inherit their parent's tags, but can also add their own.
However what I'd also like to…

P Burke
- 1,630
- 2
- 17
- 31
5
votes
2 answers
Terraform output variables to be used as input variables
I want to use output variables of one resource/module as an input to another resource/modules. Is that possible? Here i want the output value from 'outputs.tf' in root to be used as input in 'main.tf' of module.
root
|--main.tf
…

SiddhiMorajkar
- 395
- 4
- 7
- 18
4
votes
1 answer
Terraform: remote module not following providers block - Warning: Reference to undefined provider
I'm trying to use a (private) remote terraform module, and trying to pass a different provider to it. For the remote module, there are no providers defined and to my understanding, it will use a the local provider instead.
I can't seem to be able to…

hjfitz
- 399
- 4
- 15
4
votes
1 answer
Terraform: share resource between modules
I'm creating a terraform module which is working fine. However, when I use it multiple times it creates multiples roles and policies which are literally the same.
I'm thinking if there is a way for the module to create a role when I call it for the…

DevOpsNRZ
- 132
- 1
- 8
3
votes
1 answer
How to create ECR Repo before ECS with Terraform
Current Issue:
I am working with Terraform, and I am deploying AWS ECS with Fargate. I have all the applicable .tf files to do all of this, and they work, but I am also automating the deployment. So, first I would need to apply the ecr.tf file to…

anothernewbiecoder
- 65
- 4
3
votes
1 answer
How to build terraform module with blocks
I want to build a module with syntax as follows:
module "order_module" {
service {
name ="some-name"
}
lambda {
name = "some-lambda-name"
}
}
Ideally I want to be able to provide multiple service and functions in this way:
module…

Krzysztof Madej
- 32,704
- 10
- 78
- 107
3
votes
3 answers
How to know which Terraform Module Version is utilized?
Is there a way to get what’s exact version of the module being obtained or used ?
There are few places I am using the version like ~> 0.0.5 to consume the modules - would be good to know what’s used.
When I try to output the whole output block - it…

Naveen Vijay
- 15,928
- 7
- 71
- 92
2
votes
1 answer
How to get all output values from map variable in terraform?
I'm trying to extract id variable from child module to pass it to another child module. My output block in networking module is looking like
output "database_subnets_properties" {
description = "List of all* Database Subnets Properties"
value =…

Yaroslav Kovalevskyi
- 33
- 5
2
votes
0 answers
Migrate a DynamoDB table in Terraform module without destroying and recreating the table
I have a DynamoDB table that is defined in a module. I want to migrate the table away from using this module, and define it in the DynamoDB table declaration that it ultimately expands to. However, when I do this, Terraform plans to destroy and…

mmachenry
- 1,773
- 3
- 22
- 38