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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform init shows the diff as red text confusing devs #2802

Open
SSKLCP opened this issue Dec 15, 2022 · 2 comments
Open

terraform init shows the diff as red text confusing devs #2802

SSKLCP opened this issue Dec 15, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@SSKLCP
Copy link
Contributor

SSKLCP commented Dec 15, 2022

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

Whenever terraform init needs to install additional modules or import provider plugins it shows the line as red as they start with a "-". This can cause some confusion as generally we want to advise devs to be wary if any lines in red appear. I've made the "Logs" section a ```diff block so you can see how it outputs in the PR for me.

We use Terragrunt which means the backend config is frequently updated so we see this message on each run but I'd assume this is still an issue occasionally for vanilla Atlantis users.

Possible fix could be adding an escape character if "-" is the first character of a line.. Not entirely sure on the best way to implement.

Reproduction Steps

Add as the first step in plan:
- run: 'rm -rf .terraform'
and require providers in your TF as that should clear out the backend config and then it will show the message for any providers added.

Logs

Logs
Initializing modules...
Downloading git::https://dev.azure.com/xxx/xxx/_git/dns_cname_record for static_site_dns...
- static_site_dns in .terraform/modules/static_site_dns

Initializing the backend...

Successfully configured the backend "azurerm"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Finding latest version of hashicorp/azurerm...
- Installing hashicorp/azurerm v3.35.0...
- Installed hashicorp/azurerm v3.35.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

Environment details

If not already included, please provide the following:

  • Atlantis version: v0.21.0 (also tested on 0.20.1 and same issue)
  • Atlantis flags: enable-diff-markdown-format is on but I was also getting this issue without it

Running on Azure DevOps

@SSKLCP SSKLCP added the bug Something isn't working label Dec 15, 2022
@jamengual
Copy link
Contributor

do you commit the .terraform.lock.hcl file?

@SSKLCP
Copy link
Contributor Author

SSKLCP commented Dec 19, 2022

Hmm, we do not commit the lock file.

Generally we want developers to be able to commit in the tf files without needing to run anything themselves first so a lock file isn't really generated pre-Atlantis run. (And then we don't do anything with the one generated by the run) We intend to use versioned modules to control the versioning of the providers. Not sure if that's bad practice or I'm missing a better way to handle it?

@nitrocode nitrocode changed the title Initializing modules and provider plugins shows as diffs for init stage terraform init shows the diff as red text confusing devs Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants