gruntwork-io / terratest

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
https://terratest.gruntwork.io/
Apache License 2.0
7.52k stars 1.33k forks source link

remote-exec what is var.key_pair name? #1050

Open davehodg opened 2 years ago

davehodg commented 2 years ago

Tring to do a terraform plan in terraform-remote-exec-example, I get:

% terraform plan
var.key_pair_name
  The EC2 Key Pair to associate with the EC2 Instance for SSH access.

  Enter a value: ^C
Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...

╷
│ Error: No value for required variable
│ 
│   on variables.tf line 14:
│   14: variable "key_pair_name" {
│ 
│ The root module input variable "key_pair_name" is not set, and has no default
│ value. Use a -var or -var-file command line argument to provide a value for
│ this variable.

What's the all about? Google no help.

denis256 commented 2 years ago

Hi, this means that variable key_pair_name wasn't defined for Terraform

In automated tests key_pair_name is populated automatically https://github.com/gruntwork-io/terratest/blob/master/test/terraform_remote_exec_example_test.go#L79

If you try to run manually - create ec2 key pair in AWS and use the key name in key_pair_name variable