-
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
Run terraform workflows from local CLI command without a VCS #671
Comments
What about not using workspaces? Hashicorp advises not to do so for long lived environments. Use modules instead.
… On Jun 11, 2019, at 8:10 PM, Billy Shambrook ***@***.***> wrote:
Before creating the PR it can be helpful to run a plan while you are locally editing the terraform. One thing that is annoying is that if you are using workspaces in atlantis via the atlantis.yml config, there is currently no way of enforcing a specific workspace when running locally using the standard terraform cli, unless you are using the new terraform remote backend that only works with TFE.
What I would like to propose is a local sub command that would allow you to use the Atlantis cli to run a plan locally, using the config provided in the atlantis.yaml.
atlantis local plan -p dev
This would then run the same logic as it would if you submitted a pr comment...
atlantis -p dev
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hashicorp advises both directories (with modules) and workspaces in their guide: https://learn.hashicorp.com/tutorials/terraform/organize-configuration (about half way down)
We almost exclusively use workspaces. A local atlantis would be extremely helpful for us. |
This seems like it would be a non-trivial effort and overlap with tf enterprise, but it would be amazing to have. Maybe this is outside the scope of what was asked but if you could remotely execute atlantis that would be ideal. So you arent running it locally your hitting an api and atlantis is running terraform and returning the results (I think thats how tf enterprise works). That would be nice too for things like secrets- if atlantis is deployed through k8s for example and has all the secrets injected. Maybe this could be done by scripting out kubectl exec calls or something too I guess |
This would be pretty nice to have so devs do not have to rely on the PR process to run a plan if the project is complicated. projects:
- name: my-service-ue2-dev
dir: components/terraform/my-service
workspace: ue2-dev
workflow: myworkflow
autoplan:
when_modified: ["**/*.tf", "tfvars/ue2-dev.tfvars"]
workflows:
myworkflow:
steps:
- run: "..."
myworkflow-new:
steps:
- run: "..." Maybe atlantis plan --project my-service-ue2-dev
atlantis plan --project my-service-ue2-dev --workflow myworkflow-new
atlantis plan --project my-service-ue2-dev --workflow myworkflow-new --dry-run
atlantis apply --project my-service-ue2-dev --workflow myworkflow-new --dry-run A separate CLI would be easier to implement since it would only need to read the local repository's |
now with the API this could be very possible BUT the authentication will have to be done by the user as in using an oauth2 proxy or something like that |
I don't believe the user would have to authenticate if all the commands are done locally. All the user would need to have is the For example, from the above, if the user ran this locally atlantis plan --project my-service-ue2-dev --dry-run It should show the following commands (use cd components/terraform/my-service
terraform workspace select ue2-dev
terraform init
terraform plan
cd - but perhaps this could issue can be separated into a
|
local will have to have a full implementation of atlantis minus the VCS integration I guess and the remote will interact with a full deployed atlantis and then it will need auth somehow |
Auth to the atlantis api would require some effort, but maybe it could default to no auth and users just control access via firewalling. But looking at this again I realize I dont really want Atlantis local I want private terraform enterprise. Speaking for myself I dont need any of the VCS stuff. What I want is a command to upload/scp/whatever files in my cwd to the location where terraform is executed remotely. I switch to my branch before running the command, the command itself is not VCS aware. So thinking about a simple implementation:
Obvious security issues because you'd need admin perms. |
Before creating the PR it can be helpful to run a plan while you are locally editing the terraform. One thing that is annoying is that if you are using workspaces in atlantis via the atlantis.yml config, there is currently no way of enforcing a specific workspace when running locally using the standard terraform cli, unless you are using the new terraform remote backend that only works with TFE.
What I would like to propose is a
local
sub command that would allow you to use the Atlantis cli to run a plan locally, using the config provided in the atlantis.yaml.atlantis local plan -p dev
This would then run the same logic as it would if you submitted a pr comment...
atlantis -p dev
The text was updated successfully, but these errors were encountered: