Skip to content

v0.3.8

Choose a tag to compare

@github-actions github-actions released this 24 Sep 18:00
· 39 commits to main since this release

⚠️ If you use c3x top --format targets with a plan JSON

On v0.3.5 – v0.3.7, when c3x top read a plan JSON file, count and for_each instances lost their keys. The target for the single most expensive instance came out as the whole resource:

v0.3.7:  -target=aws_instance.web          # every instance of web
v0.3.8:  -target=aws_instance.web["b"]     # just the expensive one

Passed to tofu destroy / terraform destroy, the old target covers all instances of that resource. Reading a .tf directory was never affected, and both tools print the destroy plan and ask for confirmation, but please upgrade before using that workflow again.

OpenTofu support

  • .tofu files are read alongside .tf. A main.tofu replaces the main.tf of the same name, as OpenTofu does, so projects that ship both aren't counted twice.
  • Provider for_each (OpenTofu 1.9): each instance is priced in the region of the provider instance it uses.
  • Plan JSON from tofu show -json works the same as Terraform's.

Checked against OpenTofu 1.12.6: c3x reads the same resources OpenTofu plans, and prices a project's directory and its plan identically.

Fixed (Terraform users too)

  • Aliased providers are priced in their own region. A default us-east-1 provider plus an aws.eu alias previously priced both at us-east-1 rates. Module providers = { aws = aws.eu } mappings are honoured.
  • PR comments with count / for_each: instances were compared against the wrong baseline, so a change to one instance could be listed as unchanged while the total moved.
  • Missing functions gave silently wrong estimates — a cidrsubnet in a local could drop resources, a templatestring in instance_type priced a default. Added the missing Terraform built-ins and OpenTofu's cidrcontains, urldecode, base64gunzip. Functions still unsupported (file, templatefile, timestamp, uuid) now warn instead.

Upgrade note

Plan-JSON resource names now include instance keys (web["b"]). A baseline saved from a plan by an earlier version will show those resources as removed and re-added on the first diff; re-save it to clear that.

Full details in CHANGELOG.md.

Install

brew install c3xdev/tap/c3x
go install github.com/c3xdev/c3x/cmd/c3x@v0.3.8
docker pull ghcr.io/c3xdev/c3x:0.3.8