Run Pluralith in CI, generate a diagram and post it as a pull request comment.
pluralith run is primarly for usage in CI and usually preceeded by
pluralith run command is intended for use in CI. Check out how to get Pluralith set up in CI here.
pluralith run [command] [flags]
pluralith run command supports two major modes: Plan and Apply & Destroy.
plan to get an overview of which changes will happen to your infrastructure. The diagrams generated here are based on
terraform plan and, therefore, speculative. This is especially useful for pull request comments, as it gives everybody involved a clear overview of propsed changes to your infrastructure at an eye's glance.
pluralith run plan
Apply & Destroy
destroy to deploy all the changes made since the last deployment. Here Pluralith serves as a thin wrapper around
terraform apply|destroy and tracks all the apply events as they happen to enrich diagrams with information on what happened during deployment. The diagrams generated here don't just reflect planned changes, but actual changes applied to your infrastructure. They serve as a living piece of documentation that is always in sync with your deployed infrastructure.
pluralith run apply
pluralith run destroy
Why do we wrap Terraform?
Wrapping Terraform lets Pluralith do something really interesting: resource lifecycle management.
terraform apply is run with its
-json flag it outputs a precise, machine-readable set of events that contain lots of useful data, specifically information on when exactly a resource has been deployed or updated, errors that happened during deployment and similar. By wrapping
terraform apply -json and processing these events we can provide you with a Cloud Asset Inventory that always updates when your IaC does. We can track a resource's entire lifecycle and show you when resources were created, all the updates that ever happened to them and (if given) when they were destroyed. If applicable, we also run Infracost and give you a history of a resource's costs over its entire lifecycle.
pluralith run apply|destroy runs we also pipe the regular terraform output that you're used to to the console, so you always see what's up directly in your logs as well. This is a new part of the product that we are still actively exploring. We'd love your input, so if you have any ideas, questions or thoughts shoot us an email at firstname.lastname@example.org or email@example.com!
Here's a quick example on how to run Pluralith in CI. First make sure to navigate to the directory that holds your Terraform project. Inside the Terraform project simply initialize Pluralith with
pluralith init and your
project-id. Then run
pluralith run with any of the flags outlined below. After your pipeline run is done you should see a fresh run inside the Pluralith dashboard.
pluralith init --api-key $PLURALITH_API_KEY --org-id $PLURALITH_ORG_ID --project-id $PLURALITH_PROJECT_ID --project-name $PLURALITH_PROJECT_NAME
pluralith run plan
See details on
pluralith init here to learn about the various ways you can pass the necessary config to the
|Determines whether the exported diagram highlights changes made in the latest Terraform plan|
|Determines whether the exported diagram highlights resource drift detected by Terraform|
|Determines whether the exported diagram includes cost information (requires Infracost)|
|Determines which costs are shown. Can be |
|Determines over which period costs are aggregated. Can be |
|Path to an infracost usage file to be used for the cost breakdown|
|Determines whether a PDF export of your diagram is stored in your state backend alongside your Terraform state. (Currently supports |
|Determines whether a PDF export of the run is generated locally|
|The name of the exported PDF (Only relevant when |
|The directory the diagram should be exported to (Only relevant when |
|The title for your diagram, will be displayed in the PDF output (Only relevant when |
|The diagram version, will be displayed in the PDF output (Only relevant when |
|A variable to pass to Terraform. Can be specified multiple times. (Format: |
|Path to a variable file to pass to Terraform. Can be specified multiple times.|
|Path to an existing execution plan. (Generated with |
|Path to an existing JSON plan state. (Generated with |