You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I appreciate we could put this datasource in the module but we don't want to do that. We have a generic 'application' terraform module that engineering based applications use to deploy cloud resources for their app and in some scenarios they want to provision an extra datasource or an extra resource which wouldn't fit well within the standard application module. So we have a requirement to use the generate block ontop a module and be able to reference that as a Terragrunt input.
How can we achieve this?
The text was updated successfully, but these errors were encountered:
Hello,
It is possible to create a separate dependency that will generate the datasource and produce the required outputs. These outputs can then be used in other places where they are needed.
Yeah I get that pattern but it's not clean IMO and scatters an application configuration across multiple directories. It'd be nice to be able to define it all in a single Terragrunt stack
Fundamentally, Terragrunt does not load OpenTofu/Terraform providers when it runs. That's by design, as it deals with different problems than OpenTofu/Terraform. That's also required for use of data sources, as far as I know.
From a first principles perspective why do you want to use that data source? If your module always needs access to that data, why not include it in the module, or make it something that you can enable with a flag that's off by default, and on when you use a count?
If you want the module to stay simple and agnostic to where inputs are coming from, why not use something like run_cmd to fetch the value for you? My guess is that it will actually load the relevant data faster than an equivalent call to a provider data source, as it won't have to spin up a provider binary to get that data (this might depend on a lot of factors, though).
Hi,
So lets say our terragrunt.hcl looks like:
I appreciate we could put this datasource in the module but we don't want to do that. We have a generic 'application' terraform module that engineering based applications use to deploy cloud resources for their app and in some scenarios they want to provision an extra datasource or an extra resource which wouldn't fit well within the standard application module. So we have a requirement to use the generate block ontop a module and be able to reference that as a Terragrunt input.
How can we achieve this?
The text was updated successfully, but these errors were encountered: