Interview Prep/Terraform/Secrets Provisioners and Policy as Code

A teammate wants a `remote-exec` over SSH through a bastion for every new instance. What do you suggest instead?

IntermediateScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → SSH from Terraform couples infrastructure creation to network reachability and key handling.

What I'd do →

  1. Bake the setup into an AMI with Packer, or use cloud-init.
  2. For ongoing config, use Ansible over SSM Session Manager, or SSM Run Command/Association.
  3. Close port 22 entirely.

Why → No keys, no bastion, and the configuration is repeatable and testable outside Terraform.

Interview tip → "Terraform provisions, configuration management configures."

All Terraform questions

More on Secrets Provisioners and Policy as Code