Skip to content

Instantly share code, notes, and snippets.

@lenardchristopher
Last active March 14, 2021 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lenardchristopher/2450a06c0d35bfe8b6ace154639b3417 to your computer and use it in GitHub Desktop.
Save lenardchristopher/2450a06c0d35bfe8b6ace154639b3417 to your computer and use it in GitHub Desktop.
Dynamic resource creation with Terraform and CosmosDb Configuration Store
data "external" "clusters" {
program = ["python", "./cosmosdb_reader.py"]
query = {
cosmos_endpoint = var.endpoint
cosmos_key = var.primary_readonly_master_key
region = "centralus"
subscription_id = "00000000-0000-0000-0000-000000000000"
// CosmosDb query function
data_function = "get_region_peerings"
}
}
resource "azurerm_virtual_network_peering" "centralus_to_eastus" {
count = data.external.vnets.result.count
[...]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment