Skip to content

Instantly share code, notes, and snippets.

@Satak
Created September 13, 2024 18:50
Show Gist options
  • Save Satak/d0b3d00b16d92066d7e01f89fb099bd8 to your computer and use it in GitHub Desktop.
Save Satak/d0b3d00b16d92066d7e01f89fb099bd8 to your computer and use it in GitHub Desktop.
my-resource-1:
current_version: 1.9.0
product: my-manually-set-product
my-resource-2:
current_version: ${api.current_version}
product: ${api.product}
locals {
# Parse the API response
api_response = jsondecode(data.http.api.response_body)
# Process conf.yaml as a template
conf = yamldecode(templatefile("${path.module}/conf.yaml", {
api = local.api_response
}))
}
data "http" "api" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
}
output "data" {
value = data.http.api.response_body
}
output "conf" {
value = local.conf
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment