Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support skipping plan and apply in case of pull request by Renovate #151

Closed
suzuki-shunsuke opened this issue Feb 7, 2022 · 0 comments · Fixed by #153
Closed

Support skipping plan and apply in case of pull request by Renovate #151

suzuki-shunsuke opened this issue Feb 7, 2022 · 0 comments · Fixed by #153
Labels
breaking change enhancement New feature or request
Milestone

Comments

@suzuki-shunsuke
Copy link
Owner

suzuki-shunsuke commented Feb 7, 2022

Motivation

We would like to create and merge many pull requests by Renovate.
When we manage dependencies such as Terraform, Terraform Providers, tfsec, tflint, etc and create pull request per working directory, we have to handle many pull requests by Renovate.

I found that when we update tfsec and tflint we don't have to run terraform plan and terraform apply.
We only have to run tfsec and tflint.
On the other hand, when Terraform and Terraform Providers are updated, we have to run terraform plan and terraform apply.

By skipping terraform plan and terraform apply, we can efficiently update dependencies.

  • We can prevent unexpected changes from being applied
  • We can prevent CI failure due to terraform plan's unexpected changes
  • We can prevent API rate exceeded by terraform plan and terraform apply

How

Add the fields in tfaction-root.yaml.

  • skip_by_renovate
  • renovate_terraform_labels

When skip_terraform_by_renovate is true, in pull requests by Renovate terraform plan and terraform apply are skipped.
If commits by non Renovate are included in the pull request, terraform plan and terraform apply aren't skipped.
When pull request labels in renovate_terraform_labels are set, terraform plan and terraform apply are executed.

Example Configuration

tfaction-root.yaml

skip_terraform_by_renovate: true
renovate_terraform_labels:
- terraform

renovate.json

{
  "packageRules": [
    {
      "matchManagers": ["terraform", "terraform-version"],
      "addLabels": ["terraform"]
    },
    {
      "matchPackageNames": ["hashicorp/terraform"],
      "addLabels": ["terraform"]
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant