Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Overview of the Issue
We use Terraform to send a bunch of Prometheus alert manager rules to AWS Managed Prometheus. These rules are configured in multiple yaml files: we read and combine them in Terraform to get single strings, and we assign the strings to the related Terraform resources.
Some of these rules contain yaml lists of strings (example in the reproduction steps). If we run a plain Terraform plan, Terraform correctly interprets them, and reports no changes if the lists items are unchanged.
In Atlantis, we enabled enable-diff-markdown-format: true
to get colored diffs in GitHub PRs. In order to produce these diffs, it is my understanding that Atlantis takes the vanilla Terraform plan and performs some regexp-based manipulations to convert it into a GitHub-compliant Markdown format.
The problem we ran into is that specific yaml lists of strings from our Prometheus rules are matched by the Atlantis regexp and interpreted as a deletion, so in our PRs we get a bunch of apparently deleted list items, that are actually unchanged, and make it extremely harder to review the actual changes.
Reproduction Steps
This is an excerpt of a rule file that is causing the issue (look at the matchers
list items):
- receiver: pobs-priority-slack
group_by: ['...']
matchers:
- severity = warn
- priority = high
- team = pobs
I sort of reproduced the issue via Regex101 here. The regexp comes from the Atlantis source code, and the test string is a random item taken from a random matchers
list. I think the problem is given by the combination of the leading -
char, combined with the =
.
Environment details
- Atlantis version: 0.31.0
- Deployment method: ecs
- If not running the latest Atlantis version have you tried to reproduce this issue on the latest version: no
Atlantis server-side config file:
write-git-creds: false
automerge: true
disable-autoplan: false
parallel-apply: true
parallel-plan: true
parallel-pool-size: 6
allow-commands: "version,plan,apply,approve_policies,unlock"
repo-config: "/home/atlantis/config/repos.yaml"
enable-policy-checks: true
quiet-policy-checks: true
checkout-strategy: merge
emoji-reaction: rocket
enable-diff-markdown-format: true
locking-db-type: "redis"
redis-tls-enabled: true
Repo atlantis.yaml
file:
terraform_version: 1.3.2
file_types: ["alert.rules/*.yml", "alertmanager.rules/*.yml", "recording.rules/*.yml", "**/*.tf", "**/*.tfvars"]