Built-in policies
You can add policies and assign them to policy sets to add protective steps that run in conjunction with your IaCM pipelines, evaluating changes and either forcing the pipeline to fail or warning you about conditions that have not been met by your IaCM policy set.
Plan Cost Policies
In this example, you can add and configure a built-in terraform plan cost
policy that will pass or fail if the total monthly cost of your proposed infrastructure state is greater than a specified amount.
- Interactive guide
- Step-by-step
To add a new Terraform Plan Cost policy and assign it to a policy set, follow these steps:
Add a new policy
- Sign in to app.harness.io, then select Project Settings.
- Scroll down and select Policies.
- Select Policies, then select New Policy.
- Name your policy and select Apply.
- Search the sample policies library for
terraform plan cost
. - Select Terraform Plan Cost - Total Cost Estimate, then select Use this sample.
- Inspect the sample and edit the amount accordingly.
- Select Test to test the policy against the provided sample data, focusing specifically on TotalMonthlyCost.
- Select Save.
Add the policy to a policy set
- Select Policy sets.
- Select New policy set.
- Name your policy set.
- Select Terraform Plan Cost from the entity type list.
- Select Continue.
Re-review a plan policy
You can review a previously executed plan against a policy after a plan step has been executed to help determine why it failed.
- Interactive guide
- Step-by-step
To compare your previously executed Terraform plan step against a policy, follow these steps:
- Select Policy sets then select Policies.
- Select Policies, then select the policy you want to review your previously executed plan step against.
- Click Select input.
- Select the Entity type, Organization, Project and Action to search for and filter your pipeline executions.
- Select Apply.
- Review your policy TotalMonthlyCost amount against the TotalMonthlyCost of your Terraform plan input.