broad-zoo-34077
06/22/2021, 1:22 PMlittle-author-61621
early-queen-42970
early-queen-42970
eager-accountant-5294
06/22/2021, 1:44 PMlittle-author-61621
configuration.provider_config
to try and work out the regions
* `planned_values > ... resources > {address,type,values}`to build a list of resources, but the values we actually need are specified per resource.
* and configuration > ... resources > expressions
to build references between resources
For each resource, we don't have a set schema yet but you can find the values that we need by running something like this:
grep -rnw 'internal/providers/terraform' -e 'd.Get\(([^)]*)\)'
It will give you output like this:
internal/providers/terraform/azure/notification_hub_namespace.go:25: if d.Get("sku_name").Type != gjson.Null {
internal/providers/terraform/azure/notification_hub_namespace.go:26: sku = d.Get("sku_name").String()
internal/providers/terraform/azure/linux_virtual_machine.go:26: instanceType := d.Get("size").String()
internal/providers/terraform/azure/linux_virtual_machine.go:30: if d.Get("additional_capabilities.0.ultra_ssd_enabled").Bool() {
internal/providers/terraform/azure/app_service_environment.go:27: if d.Get("pricing_tier").Type != gjson.Null {
internal/providers/terraform/azure/app_service_environment.go:28: tier = d.Get("pricing_tier").String()
everything inside the d.Get()
call is a path within the values
object for the resource.
Then we also use some other values for building the references, which you can get from the ReferenceAttributes
property of each resource, e.g.: https://github.com/infracost/infracost/blob/master/internal/providers/terraform/aws/elasticache_cluster.go#L16.eager-accountant-5294
06/22/2021, 6:34 PMlittle-author-61621
It seems like after parsing the TF plan, there is a struct defining the Project and its Resources.Yep, the problem with querying the graphql API directly is that all the mappings from the terraform resources are in the CLI. Is it possible to create a plan that includes those
d.Get()
values?eager-accountant-5294
06/22/2021, 8:38 PMlittle-author-61621
early-queen-42970
eager-accountant-5294
06/22/2021, 9:39 PMlittle-author-61621
eager-accountant-5294
06/22/2021, 10:47 PM