5

The resource "azurerm_network_interface_backend_address_pool_association" "network_interface" block doesn't have the count argument set, so count.index is not meaningful in that block. Given the specific pair of resource types you're using here, I expect your intent was to create one association for each network interface, in which case you'd add the ...


3

These are hacks (understandably as you couldn't explicitly do this in Terraform < 0.13). Now however, with 0.13, we have depends_on for modules: https://github.com/hashicorp/terraform/blob/v0.13/CHANGELOG.md#0130-august-10-2020


3

I think a key difference between Terraform Modules and Workspaces is that modules can be inherited and used by other modules and configurations. Terraform Workspaces are intended to be a collection of configurations that represent a single environment, whereas Modules are components that can be utilized by one or more modules/configurations. I think you ...


2

A Terraform module is represented by a whole directory, not an individual file. If you create a directory ./modules/queues and move ./modules/queues.tf to ./modules/queues/queues.tf then you can call that module like this: module "pae_queues" { source = "./modules/queues" environments = var.environments }


2

The workaround is to pull the current state file, edit it and use it as a base line. For example: $ terraform state pull > terraform.tfstate $ vim terraform.tfstate # Carefully remove invalid entries. $ python -mjson.tool terraform.tfstate # Validate JSON. Note: In Vim, placing cursor on the opening bracket, hitting d% will remove the whole group. Then ...


2

Terraform modules are a way to encapsulate reusable business logic in order to be DRY. For example, you might use a module to define a jenkins setup, then invoke that module every time you want a jenkins server. In other words, you can instantiate modules as many times as you need them to achieve the same outcome. On the other hand, Terraform workspaces ...


2

The most popular answer is out of date with Terraform in version 0.12.24. depends_on is a protected variable, and cannot be used in a module. In addition there are a few syntax differences. I've updated the example below. # ROOT level main.tf # ------------------------------------------------------------------- # Create NAT Gateway - Associates EIP as ...


2

There is a hacky workaround for getting Terraform to do module dependencies. You can force the module to be aware of the Terraform calling it like this: # ROOT level main.tf # ------------------------------------------------------------------- # Create NAT Gateway - Associates EIP as well # ------------------------------------------------------------------- ...


1

The provider documentation you quoted here seems to have a mistake. It talks about using the two providers together in the same module but it seems like it really means in the same configuration. The problem arises because Terraform needs to configure a provider in order to plan with it, and so everything inside a provider "kubernetes" block must ...


1

I believe you should be able to reference the namespace name like so: namespace_name = azurerm_eventhub_namespace.eventhub[0].name However, if the namespace_name field is a required parameter on the resources you are passing it to, you might run into other issues while you are trying to set enabled to false, as the resources depend on the output of the ...


1

Terraform is idempotent so will only change what needs to be changed. So after applying your existing plan, if you add more modules or resources and run another plan and apply, it will add the new resources not the whole infrastructure. Terraform import is used when you want to start managing a resource created outside your Terraform code for example created ...


1

You might be able to do something with the local-exec Provisioner to push the information out to an external script or file which you could monitor separately during the run. The issue you might encounter is the run order, HCL isn't processed top to bottom like a "traditional" programming language, it works out a dependency tree for the resources ...


1

What you've described here is the recommended way to pass dependencies between modules, but it relies on features introduced in Terraform 0.12. You appear to be using Terraform 0.11, where unfortunately these features are not available. For Terraform 0.12 it would be idiomatic to write it using the "first-class expressions" syntax, like this (with these ...


1

Each module has its own set of input variables. The input variables for the root module are set when you run Terraform, e.g. on the command like with the -var option. The input variables for any child module, like your module "logs" here, are set inside the module block. Each variable declaration is valid only for the module it appears in. You happen to ...


1

It seems like the intent of this expression is to take the result of encoding that data structure which contains numbers and boolean values in quotes and produce a new version with those values unquoted. For example, anywhere the result contains the sequence "true" it would be replaced with true, quotes removed to produce a real JSON boolean value rather ...


1

I think you could achieve something similar by first running Terraform against your RDS resources, and then running Terraform again on all resources. On your first pass, you can use -target option to target only a subset of the resources. (ie. RDS resources). Be aware that using this option is not recommended in Terraform docs. If I were you, I would use ...


Only top voted, non community-wiki answers of a minimum length are eligible