Andrew Ravn
05/05/2025, 8:34 PMprovider "context" {
delimiter = "-"
enabled = true
properties = {
environment = {}
name = {}
org = {}
region = {}
type = {}
}
property_order = [
"org",
"region",
"environment",
"type",
"name",
]
# Default values, can be overridden in the data sources
values = {
"org" = "evh"
"region" = "ue2"
"environment" = "prod"
"type" = "vpc"
"name" = "main"
}
}
data "context_tags" "this" {
values = {
"managed_by" = "terraform"
}
}Andrew Ravn
05/05/2025, 8:36 PMmanaged_by tag
> data.context_tags.this.tags
tomap({
"Environment" = "sand"
"Name" = "main"
"Org" = "evh"
"Region" = "ue2"
"Type" = "vpc"
})managedkaos
05/06/2025, 6:00 AMdata resources are read only. I though they were only used to bring data into a workspace. So attempting to update a data resource may be allowed (looks like it compiled for you), but I don’t think you can modify it. 🤔
from the TF docs:
Data sources allow Terraform to use information defined outside of Terraform, defined by another separate Terraform configuration, or modified by functions.do the cloudposse docs say something different? specifically, that the
context_tags data resource can be modified?managedkaos
05/06/2025, 6:02 AMTheblock creates a data instance of the given type (first block label) and name (second block label). The combination of the type and name must be unique.data
Within the block (the) is configuration for the data instance. The configuration is dependent on the type; as with resources, each provider on the Terraform Registry has its own documentation for configuring and using the data types it provides.{ }
Each data instance will export one or more attributes, which can be used in other resources as reference expressions of the formdata.<TYPE>.<NAME>.<ATTRIBUTE>
Andrew Ravn
05/06/2025, 2:47 PMAndrew Ravn
05/06/2025, 3:00 PMAndrew Ravn
05/06/2025, 3:00 PMvalues (Map of String) Map of values to override or add to the context when creating the label.Andrew Ravn
05/06/2025, 3:00 PMErik Osterman (Cloud Posse)
05/07/2025, 6:22 PMErik Osterman (Cloud Posse)
05/07/2025, 8:23 PMErik Osterman (Cloud Posse)
05/07/2025, 8:23 PM