able-pencil-95187
03/13/2023, 5:03 PMinfracost
? Our team doesn't use Terraform, but I'm interested in the Cloud Pricing API
server. I'm looking to dynamically construct a GraphQL query to submit to a self-hosted Cloud Pricing
server, and I'm looking to see how infracost breakdown
works. Taking this Terraform example:
$ cat <http://ec2_simple.tf|ec2_simple.tf>
resources "aws_instance" "my-web-service" {
instance_type = "t2.micro"
}
Running infracost breakdown -p .
gives us: OVERALL TOTAL $9.27
. I'm looking to see what the GraphQL query looks like in this simple example, then to construct larger Terraform files to see how the query changes.little-author-61621
query {
compute: products(filter: {
vendorName: "aws",
service: "AmazonEC2"
region: "us-east-1"
productFamily: "Compute Instance"
attributeFilters: [
{key: "instanceType", value: "t2.micro"}
{key: "tenancy", value: "Shared"}
{key: "operatingSystem", value: "Linux"}
{key: "preInstalledSw", value: "NA"}
{key: "licenseModel", value: "No License required"}
{key: "capacitystatus", value: "Used"}
]
}) {
attributes {
key, value
}
prices(filter: {
purchaseOption: "on_demand"
}) {
USD
}
}
}
There’s also some docs here with an example request.able-pencil-95187
03/13/2023, 5:18 PMlook through the code for each resource and look at the values we pass@little-author-61621 can you link the directory for the resources? I might be able to extrapolate a lot
little-author-61621