Challenge - 5 Problems
SSH Connection Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Configuration
intermediate2:00remaining
Identify the correct SSH connection block for Terraform
Which connection block will successfully configure SSH access to a Linux VM with user 'admin' and private key at '~/.ssh/id_rsa'?
Attempts:
2 left
💡 Hint
The private_key must be loaded as file content, not as a path string or public key.
✗ Incorrect
Option D correctly uses 'user' (not 'username'), loads the private key file content with file(), and uses the public IP as host. Option D uses 'username' which is invalid. Option D assigns the path string directly instead of file content. Option D uses the public key file instead of the private key.
❓ service_behavior
intermediate1:30remaining
Effect of missing SSH connection block in Terraform provisioner
What happens if you run a Terraform provisioner that requires SSH but omit the connection block entirely?
Attempts:
2 left
💡 Hint
Terraform needs explicit connection info to connect via SSH.
✗ Incorrect
Terraform requires explicit connection blocks for SSH provisioners. Without it, Terraform cannot connect and will error out. It does not guess credentials or skip provisioners silently.
❓ Architecture
advanced2:30remaining
Choosing the best SSH connection method for a private subnet VM
You have a VM in a private subnet without a public IP. Which connection block setup allows Terraform to SSH into this VM securely?
Attempts:
2 left
💡 Hint
Private subnet VMs need a jump host or proxy to access via SSH.
✗ Incorrect
Option C correctly uses a bastion host with SSH proxy to reach private subnet VMs. Option C fails because private IPs are not reachable from Terraform's machine. Option C uses a different protocol (WinRM) not applicable here. Option C changes architecture and may not be allowed.
❓ security
advanced2:00remaining
Security best practice for SSH private keys in Terraform connection blocks
Which practice improves security when specifying SSH private keys in Terraform connection blocks?
Attempts:
2 left
💡 Hint
Avoid hardcoding sensitive data directly in code.
✗ Incorrect
Option B follows best practice by injecting private keys securely via variables or environment variables. Option B risks exposing keys in code. Option B is invalid because public keys cannot be used for SSH authentication. Option B exposes sensitive data in state files, which is insecure.
🧠 Conceptual
expert3:00remaining
Understanding SSH connection block behavior with dynamic host IP changes
If a Terraform-managed VM's public IP changes after initial deployment, what happens to the SSH connection block referencing 'self.public_ip' during subsequent apply runs?
Attempts:
2 left
💡 Hint
Terraform references resource attributes dynamically during each apply.
✗ Incorrect
The 'self.public_ip' attribute always reflects the current resource state, so Terraform uses the updated IP automatically. It does not cache old IPs or require manual updates for connection blocks.