#atlantis - December 2018

atlantisArchived
127 messages

Discuss the Atlantis (runatlantis.io)
Archive: https://archive.sweetops.com/atlantis/

December 2018
rohit
rohitalmost 8 years ago
Hello. So i am thinking about using Atlantis and was wondering how to set it up
rohit
rohitalmost 8 years ago
Also, is it possible to run terraform commands when we use atlantis ?
rohit
rohitalmost 8 years ago
like for example, terraform workspace command
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Yes, you can run any arbitrary commands
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Atlantis understands workspaces too
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@antonbabenko has module for it
antonbabenko
antonbabenkoalmost 8 years ago
https://github.com/terraform-aws-modules/terraform-aws-atlantis - I have not used it much since the release, so it may require some polishing.
rohit
rohitalmost 8 years ago
awesome
rohit
rohitalmost 8 years ago
so once atlantis is setup, do we run arbitrary commands in github ?
antonbabenko
antonbabenkoalmost 8 years ago
yes, in github PR comment users should be able to write everything atlantis can recognize - atlantis plan
rohit
rohitalmost 8 years ago
nice
Arwin Tugade
Arwin Tugadealmost 8 years ago
Hey all, I've been playing around with Atlantis and I'm at a point where I want proof of concept this in an actual workflow. My setup for AWS accounts one per environment (dev, stg, prd) with an instance of Atlantis in each account/environment. Dev teams will hook into Atlantis via an atlantis.yml and webhook. This is what my question revolves around, in this sort of setup, what does the webhook setup for a repository look like if you have 3 separate Atlantis instances?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
So, it basically comes down to how you organize your infra. In our case, we have 1 repo per AWS account.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
and then a terraform-root-modules that acts like a library we can pull from
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
so then in each of our account repos, we pull in the terraform root modules that we want to use
Arwin Tugade
Arwin Tugadealmost 8 years ago
Do you treat application repos the same way? And how do you promote changes from one env to the other? For instance, in the case you're talking about, say i've made some changes to the vpc in the dev repo that needs to be reflected in stg and prd.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
so all changes are made to terraform-root-modules and tagged
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
then you update the tag in the corresponding environment with a PR <-- which you can use atlantis to execute
Shane
Shanealmost 8 years ago
@Arwin Tugade for my setup we have all of our terraform in a single repo with 3 folders, dev, prod, stg and a single atlantis that applies them all.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
yea, I think that’s the most common approach and the use-case I think atlantis was originally built for
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
the part about that I struggle with is controlling access and reducing blast radius
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
this is why we forked atlantis to implement the basic ACLs
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
those ACLs are scoped to a particular instance of atlantis
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
then we can deploy atlantis into different AWS accounts and control who can do what based on GitHub team membership
Shane
Shanealmost 8 years ago
we do that by using CODEOWNERS and requiring approval before an apply
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
has something changed?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
Last I was aware, CODEOWNERS prevents merging, but mergability is not yet used to determine who can plan or apply
Shane
Shanealmost 8 years ago
My understanding was that it linked into the approval process. I'll verify that requirement.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
it does, but it only requires that one of the CODEOWNERS approves
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
but it doesn’t prevent anyone else from also approving
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
and atlantis only checks if it has been approved
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
but not if it can be merged
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Shane
Shanealmost 8 years ago
@Erik Osterman (Cloud Posse) ahh good catch
Shane
Shanealmost 8 years ago
I guess I should put in some PRs
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
😃
Shane
Shanealmost 8 years ago
Anyone want to have a conversation around - https://github.com/runatlantis/atlantis/issues/43
Shane
Shanealmost 8 years ago
I would like to implement it, but I want to get some opinions
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 8 years ago
@Shane let’s discuss that
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 8 years ago
we already added some security to our atlantis fork https://github.com/cloudposse/atlantis/releases/tag/0.1.0
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@mumoshu would maybe also be interested in that flag
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
He got busy with Reinvent so couldn’t get back to his PR for custom stages
Shane
Shanealmost 8 years ago
My prime interest is in using the merge able state and allowing github to do the logic on if it's safe to apply.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
I think the interface laid out by Luke looks good by adding a parameter like the require-approval
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Add require-mergability
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
I think it should be also available to “plan”
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
A user can execute any command as part of plan
Shane
Shanealmost 8 years ago
In that case would it be better to create 2 separate flags or a flag that has a value and requires mergability for all steps below it in the chain
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 8 years ago
would we want to do plan even if the PR could not be merged for any reason?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
So right now there are “apply_requirements”, then maybe “plan_requirements” for consistency
Shane
Shanealmost 8 years ago
So if that's how that was designed how would you layout the flags
Shane
Shanealmost 8 years ago
Would you do a flag per state?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
“State” in this case refers to...?
Shane
Shanealmost 8 years ago
stage as in plan, apply
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 8 years ago
we played a bit with the GitHub branch protection API in Go, something for reference https://github.com/cloudposse/github-status-updater/blob/master/main.go#L145
Shane
Shanealmost 8 years ago
@Andriy Knysh (Cloud Posse) thanks I'll take a look
Shane
Shanealmost 8 years ago
Stab at adding support for rebasing onto master - https://github.com/runatlantis/atlantis/pull/374
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
that’s cool!
Shane
Shanealmost 8 years ago
I implemented it in the simplest way as possible that fits my use-case please let me know if you would like to see any tweaks.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
makes sense - i hadn’t considered the fact we should be rebasing before running plan/apply, but agree since we always do that before merging.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
dependabot does that - which is nice
Shane
Shanealmost 8 years ago
anyone else see an issue with atlantis with multiple github hooks being processed
Shane
Shanealmost 8 years ago
Shane
Shanealmost 8 years ago
.... apparently the tool I'm using to display logs is the culprit...
Shane
Shanealmost 8 years ago
with a stateful set whenever you have a new container it tails that container, but since it's the same name it tails it X amount of times where X is the amount of new containers that have started since you started the tail....
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
which tool are you using?
Shane
Shanealmost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
btw, if you’re not able to get your PR merged upstream in atlantis, we’ll accept it in cloudposse/atlantis 😃
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@Shane ☝️
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
woohoo!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@Andriy Knysh (Cloud Posse) ☝️
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)almost 8 years ago
👏
Shane
Shanealmost 8 years ago
Looks like it just got merged
Shane
Shanealmost 8 years ago
That's a nice addition
erik
erikalmost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@Shane what do you think about this?
Shane
Shanealmost 8 years ago
so that would be a global setting for any terraform in that repo to allow for executing something prior aka in your example rebase?
Shane
Shanealmost 8 years ago
That's likely helpful as you want to do it before plan and before apply so you would not want it to be part of the apply/plan chain
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
My understanding is that it's generalized settings for a particular repo
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
so in your case, it's that you want to rebase after checking out
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
in our case, we wanted to update submodules
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
i am thinking this could maybe be solved in the generalized way of adding commands
Shane
Shanealmost 8 years ago
ya, that sounds reasonable
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
(not sure if there are global settings - which would also be nice)
Shane
Shanealmost 8 years ago
basically any action that you wanted to fire off, before a command.
Shane
Shanealmost 8 years ago
kind of a pre-hook for any action
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
yea, almost like a pre-hook indeed
Shane
Shanealmost 8 years ago
maybe changing the name to something like pre-command would make more sense
Shane
Shanealmost 8 years ago
or pre-actions
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
oh, so id is a regex, so it's possible to set globals
erik
erikalmost 8 years ago
i5okie
i5okiealmost 8 years ago
hi
i5okie
i5okiealmost 8 years ago
just recently found out what atlantis is. holy cow this is coooool
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Yea, atlantis is very sweeet!
antonbabenko
antonbabenkoalmost 8 years ago
@i5okie and others, I have just added Gitlab and SSM support into Atlantis AWS Fargate module - https://github.com/terraform-aws-modules/terraform-aws-atlantis/
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Had some time to get back to coding?
antonbabenko
antonbabenkoalmost 8 years ago
Well, kind of. At the same time I need to do work for customers implementing Terraform while there are no conferences. My next travel will be in 39 days.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
That’s almost like a vacation for you
antonbabenko
antonbabenkoalmost 8 years ago
ohh, yes, though I try to not mix work and vacation. Looking forward to my month off in July already 🙂
Shane
Shanealmost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
we’re using our monochart though
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
also, only tested it against our flavor of cloudposse/atlantis
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
after using monochart i get frustrated using any other charts because it’s so standardized
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
what’s cool, is we package this helmfile with the container, so it works like a heroku Procfile
mumoshu
mumoshualmost 8 years ago
im rethinking my pr to add custom stages to atlantis
https://github.com/cloudposse/atlantis/pull/20

can't we just a write a webhook proxy server that sits in front of atlantis instead?

it should either (1) forward the webhook payload as-is to atlantis if it is atlantis plan blah or atlantis apply or (2) run preconfigured shell commands matching the pull request comment body.

this way, we have no need to scope-creep atlantis.

in theory, it will also allow extending atlantis without modifying it in some cases, like running multiple atlantis instances each for different branch.

also, you can add a mono-image containing both atlantis and the proxy then collocate it in the same fargate svc for easy integration/hosting.

maybe im getting crazy but wanted some feedback!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago

webhook proxy server that sits in front of atlantis instead
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
i mean, at this point is atlantis even in the picture?
mumoshu
mumoshualmost 8 years ago
i suppose you can choose
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
yea, like if we ultrageneralize this
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
webhook proxy that runs a command
mumoshu
mumoshualmost 8 years ago(edited)
if you bring atlantis in to the picture, you don't need to reimplement tf-project locking and plan/apply functionalities
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
that command could be a taskrunner
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
it could be make
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
aha, i see
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@Shane how are your atlantis adventures going?
Shane
Shanealmost 8 years ago
I have not touched Atlantis in at least a week. Playing with prometheus operator atm.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
@mumoshu aha! I see what you’re staying now
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
basically, the proxy would look at the request and decide how to route it
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago
and alternatively, be able to call out to some thing else
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)almost 8 years ago(edited)
it’s like a github webhook router
mumoshu
mumoshualmost 8 years ago
yeah that's my point 👍️
Shane
Shanealmost 8 years ago
Don't know if anyone has sway in helm/charts repo - https://github.com/helm/charts/pull/10256