This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue-id
PR Checklist
Description
Currently, we have no options to reference resources that are not being managed by the CAF Module.
This PR provides a way to dynamically add data sources for gathering data from external resources.
It can be handy as many of us have to deal with the existing infrastructure that is not worth importing to CAF's module.
General guidance
Using this requires a new variable (
data_sources
) with the following structure:example:
You can check the data source documentation so you know which attributes are needed.
If we want to query for a subscription our
data_sources
variable would look like this:And then you can refer to that subscription like:
Caveats
For most cases, you can only refer to resources at the same subscription that you've configured your backend as most of data sources needs the resource group name (which is scoped to the subscription) as an input.
In our example case, the
subscription
data source is not tied to the subscription that your authenticated principal is using, so it will work if your credentials have access to it.Does this introduce a breaking change
In order to have it working, the
aztfmod
module needs the variabledata_sources
in place and somelocals
changes.The aztfmod/terraform-azurerm-caf/pull/1068 must be merged first.
Testing