Run Pluralith in CI
Run Pluralith in CI to completely automate your infrastructure documentation and always have a fresh infrastructure diagram with latest changes, drift detection, cost and compliance data whenever you need it.
Before you can get started you need a Pluralith account. Create one through the button below.
Infrastructure History:The Pluralith dashboard gives you a record of all the changes ever made to your infrastructure and shows you how costs, drift and compliance evolve over time.
Cloud Asset Inventory:Running Pluralith in CI lets you track all the resources you deploy and get detailed insights into their lifecycles and costs.
PR Comments:Post diagrams (with cost, drift and compliance information) as pull request comments.
Markdown Integration:Integrate Pluralith into any markdown-based documentation system and have an always up-to-date infrastructure diagram (with cost, drift and compliance information) directly inside your docs.
Pluralith & Terraform State
First things first: Pluralith never sends your state to a backend. Your Terraform state always gets processed locally on your pipeline runner. The only thing that gets passed on and stored in our backend is the diagram in
json form, which contains nothing but resource types, names and coordinates.
Although Pluralith can run in pretty much every CI workflow, we have dedicated integrations for some platforms (more coming soon).
For All Other CI Platforms
To run Pluralith on any given CI platform you really only need to get the CLI installed and you are ready to go. Here's a step by step guide:
Here we are assuming you already have Terraform set up in your CI worklow. If not, check out HashiCorp's installation guides here.
1 Run Install ScriptWe prepared a little install script for you to make things easier. Use the command below to download and execute it in your CI system:
curl https://raw.githubusercontent.com/Pluralith/pluralith-cli/dev/scripts/install.sh | sh
We recommend running Pluralith in the
node:latest image, as the PR comment functionality depends on an npm package.
2 Initialize PluralithHave your `api-key`, `org-id` and `project-id` ready as environment variables. If no project with the given `project-id` exists yet, also make sure to pass a `project-name` (learn more about `pluralith init` parameters [here](https://docs.pluralith.com/docs/commands/init)). Then run the following command:
pluralith init --api-key $PLURALITH_API_KEY --org-id $PLURALITH_ORG_ID --project-id $PLURALITH_PROJECT_ID --project-name $PLURALITH_PROJECT_NAME
3 Run PluralithNow you are all set to run Pluralith, generate a diagram and post it as a pull request comment. The run command supports multiple Terraform commands.
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
More info on why we wrap Terraform and all the CLI options you have here.
4 Add To ReadMe
Pluralith allows you to always have the latest diagram of your infrastructure directly inside your repo's README. You can set up the README integration by copying the markdown snippet in your project's settings (Go to the Pluralith Dashboard, open your project, click on settings and there you can find it under "ReadMe Integration").
Here's an example we set up with our fork of the
terraform-aws-vpc-modulerepo. As you can see the latest diagram is always present in the repo README.
And here's a screenshot of the project settings screen: