-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 remaining atlantis
terraform commands
#2776
Comments
@nitrocode as I mentioned in slack, doing a pass thorough it could make the code pretty difficult to manage once a feature like this is released and people start sending PR to add logic to deny access to certain commands and such, we could end up having a huge amount of policy code everywhere for every command etc. |
I imagined it more like this in the server config atlantis_allowed_terraform_subcommands:
- validate
- state
- import
- providers Then it would only allow select commands. I figured it would be less work to maintain a pass thru command then adding each subcommand separately in golang which is our current method. And if terraform releases a new subcommand then it's one more subcommand to support. If the community would prefer to be explicitly create each subcommand in golang, then someone would need to write the code to support each one I suppose. |
atlantis terraform
pass through commandatlantis terraform
pass through command
atlantis terraform
pass through commandatlantis
terraform commands
I changed this ticket around so it has multiple options for supporting the remaining terraform commands. Option 2 is pass through and Option 1 is what we're currently doing. This ticket will at least contain each of the secondary tickets for supporting each terraform subcommand. |
@nitrocode @krrrr38 How are this commands supposed to work with workflow hooks? I was trying to get |
I guess it should works, could you put reproduce steps and create a ticket?
Please check this docs. --executable-name may help you. |
I went through my configuration and the first issue was actually missing The second issue I think is the order of checks that atlantis performs when parsing comments: it checks if the command is allowed before checking if repo/branch is in allowlist. ===edit
|
Please create a separate issue for this. |
Having the ability to run |
Could we add another issue for the This ticket would likely be relevant as additional tests (such as terratest) could be added to the steps in the test workflow. |
Hello everybody, |
I'd love to see |
Do we currently have any way to remove a remote backend from state? Terraform's state rm removes the state resource, but from what I understand, Atlantis' state rm removes the plan file. This command discards the result of the terraforming plan. I need to remove a resource and recreate it via atlantis and I don't know how to do it. The idea is to recreate the random_password resource to force a password change for another user resource. |
@SamuelMolling you don't need to remove the resources from the state. Use the keepers configuration instead. As a side note, removing resources from state should only be required when you are migrating resources from a state file to another or something went wrong and you need to cleanup, not as a regular process. |
@GMartinez-Sisti The documentation says that to use keepers, I need to run taint and this command is not available in Atlantis, right ? |
Not as a regular command, but you can add it if you want using a Custom Workflow, however if you implement keepers the correct way it should trigger a change on plan when the linked resources change. |
In my case, it thinks that for some reason we need to change the password, but we don't have access to the console or anything related. We would need a way to change using the pipeline. |
As a suggestion, you can create a terraform variable of type string and link it to the keepers config. Whenever that variable changes the password will change, you can use whatever value you want in the variable: a date, a ticket, a reason, the content doesn't matter since the goal is to just change the password. Taint should be used as a last resort, avoid using it as a daily operation since you might mess up your terraform state file while doing it. |
Community Note
Describe the user story
There are a lot of missing terraform commands and I do not like running them locally. I'd like to run them all from github.
Describe the solution you'd like
remaining (in order of highest value)
terraform refresh
-replace
atlantis plan -- -replace=aws_s3_bucket.example
terraform taint
terraform untaint
Lower value
terraform state list
terraform validate
init
terraform providers
done
terraform import
as of v0.22.xterraform state rm
as of 0.23.x (unreleased, usedev
tag image)won't do
terraform destroy
atlantis plan -- -destroy=aws_s3_bucket.example
terraform state mv
move
blocks in terraform 1.xOption 1: implement each subcommand
This is what we currently do.
Write golang code for each terraform subcommand that exists today and future subcommands that are created...
Option 2: Pass through command
There are many current issues for each
terraform
subcommand and it seems difficult to scale up.It would be nice to create a pass through command so all terraform commands can be supported.
Spacelift, for instance, supports only plan and apply out of the box. However, they have a separate section in the UI that allows running any arbitrary commands, even non terraform commands. Of course to get to their UI, the user has to be authenticated through sso/saml and things are gated using rego policies which we do not currently support.
Pros:
Cons:
terraform destroy
command would become available unless we wrote the code so select subcommands of terraform could be disabled using a config/flag.References
atlantis validate
subcommand #2766atlantis destroy
subcommand #941atlantis state rm
subcommand #273atlantis import
subcommand #217-replace
(sinceterraform taint
subcommand is deprecated) #527atlantis test
subcommand #4409atlantis untaint
subcommand #4464atlantis cancel
#187The text was updated successfully, but these errors were encountered: