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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bastion terraform #171

Merged
merged 3 commits into from
Sep 15, 2021
Merged

Bastion terraform #171

merged 3 commits into from
Sep 15, 2021

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Sep 7, 2021

This moves all the AWS resource declarations to terraform.

The terraform state has been imported from the existing resources and is clean. It's not the cleanest terraform since it's just a straight import.

The nixops state can probably be destroyed and re-created since we don't care about the old resources anymore and the state is not needed anymore.

Now it's possible to nixos-rebuild switch --flake .#bastion --use-remote-sudo to deploy from the bastion host.

Fixes #171

@zimbatm zimbatm requested review from grahamc and edolstra September 7, 2021 21:03
@zimbatm zimbatm force-pushed the bastion-terraform branch 2 times, most recently from 1ef0035 to 88438a9 Compare September 8, 2021 09:16
@edolstra
Copy link
Member

edolstra commented Sep 8, 2021

I'd prefer not to do this until we can do the entire deployment using only terraform. This change will make deployment harder/uglier since you now need two tools to manage the infrastructure. And NixOps cannot reference output values from terraform, so you get ugly things like deployment.targetHost = "bastion.nixos.org".

@zimbatm
Copy link
Member Author

zimbatm commented Sep 8, 2021

Ok.

Note that the current NixOps deployment is broken and is blocking the fixes to the channel script in NixOS/nixos-channel-scripts#49

The latest commit deploys with terraform, but I'm hitting another issue now: nix-community/terraform-nixos#60

@grahamc
Copy link
Member

grahamc commented Sep 8, 2021

I'd prefer not to do this until we can do the entire deployment using only terraform. This change will make deployment harder/uglier since you now need two tools to manage the infrastructure. And NixOps cannot reference output values from terraform, so you get ugly things like deployment.targetHost = "bastion.nixos.org".

I am not very excited about terraform as a NixOS deploy tool. I've found it a bit slow, and doesn't handle partial network deployments very well. I've had good success using a combination of Terraform + Morph. Perhaps I could demo how that works?

@zimbatm
Copy link
Member Author

zimbatm commented Sep 8, 2021

I don't really care, just pick something so I can deploy the channel script updates. With the implementation in this branch, it will also be possible to nixos-rebuild switch from the bastion directly.

@zimbatm zimbatm force-pushed the bastion-terraform branch 3 times, most recently from 86718db to 9a497f6 Compare September 14, 2021 18:17
All the resources have been imported in the terraform state and have a
clean plan.
@zimbatm
Copy link
Member Author

zimbatm commented Sep 14, 2021

I had to fork tweag/terraform-nixos to make it work with our sub-folder flake.

@zimbatm
Copy link
Member Author

zimbatm commented Sep 15, 2021

Assuming that this is fine.

@zimbatm zimbatm merged commit 44df004 into master Sep 15, 2021
@zimbatm zimbatm deleted the bastion-terraform branch September 15, 2021 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants