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 →
- Bake the setup into an AMI with Packer, or use cloud-init.
- For ongoing config, use Ansible over SSM Session Manager, or SSM Run Command/Association.
- 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."
More on Secrets Provisioners and Policy as Code
A developer hardcodes a DB password in `terraform.tfvars` and commits it. What do you do right now, and what's the long-term fix?BeginnerHow do you avoid Terraform persisting a secret in state when creating a secret in AWS Secrets Manager?AdvancedSomeone wants a `remote-exec` provisioner to configure servers after creation. What's your advice?BeginnerYou must run a one-off command after a resource is created, such as registering with an external system.IntermediateHow do you generate and manage the master password for a new RDS instance?IntermediateCompare Sentinel, OPA/Conftest and Checkov for policy as code.Intermediate