equinix / terraform-equinix-metal-openstack

OpenStack Cloud on Equinix Metal
https://registry.terraform.io/modules/equinix/openstack/metal/latest
Apache License 2.0
13 stars 12 forks source link

Provision ssh keys with Terraform #49

Closed displague closed 3 years ago

displague commented 3 years ago

The instruction to create an SSH key by hand https://github.com/equinix/terraform-metal-openstack#deployment-prep, can be avoided by generating the key with Terraform: https://github.com/equinix/terraform-metal-anthos-on-baremetal/blob/v0.3.0/main.tf#L30-L44

In this way, the SSH key will be registered in userdata and configured by cloud-init.

Lines such as these (which add the SSH key contents to userdata directly) will not be necessary: https://github.com/equinix/terraform-metal-openstack/blob/4c4f30b7e2cd76f9fa19b41d2d3289889b04d500/BareMetal.tf#L22

Instances of key copying can create the remote file using the content property instead of file, following the same pattern found in the anthos project. https://github.com/equinix/terraform-metal-openstack/blob/4c4f30b7e2cd76f9fa19b41d2d3289889b04d500/DistributeKeys.tf#L16-L19

We can also remove these instructions if we adapt this behavior: https://github.com/equinix/terraform-metal-openstack#ensure-that-your-equinix-metal-account-has-an-ssh-key-attached

displague commented 3 years ago

The requirement to create an ssh manually makes it harder to integrate this as a module and it is a missing step in our GitHub action.

displague commented 3 years ago

Closed by #51