You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-slackgroup_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
Hey @luca-poddigue-hs! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together!
The issue you're experiencing with YAML lists being interpreted as deletions in Markdown-converted Terraform plans is likely due to the way Atlantis processes the plan output for Markdown formatting. Specifically, the combination of a leading - character and the = sign in your YAML lists might be triggering a regular expression that Atlantis uses to format the output.
Currently, there isn't a specific workaround or configuration in Atlantis to prevent this misinterpretation directly. However, you might consider the following approaches:
Modify the YAML Format: If possible, adjust the format of your YAML lists to avoid the pattern that triggers the regex. For example, you could try using a different character or format that doesn't start with -.
Custom Atlantis Configuration: Review your Atlantis configuration to see if there are any options that might affect how diffs are generated. Although there isn't a direct setting to change this behavior, ensuring that your configuration is up-to-date and optimized might help.
Atlantis Version Update: Consider testing with the latest version of Atlantis, as there might be updates or fixes related to Markdown formatting that could address this issue.
Regex Adjustment: If you have the capability to modify the Atlantis source code, you could adjust the regular expression responsible for this behavior. However, this requires a good understanding of the codebase and the potential impact of such changes.
These suggestions are based on the current understanding of how Atlantis processes Terraform plans into Markdown format [1][2].
Community Note
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):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 server-side config file:
Repo
atlantis.yaml
file:The text was updated successfully, but these errors were encountered: