Loading...
Loading...
I have this on my connection. The goal is to copy a file to this server on ec2. ``` connection { type = "ssh" host = aws_instance.example[0].public_ip user = "ec2-user" private_key ="${file(var.ssh_key_file_path)}" } ``` However terraform does not accept the content of the file as in the documentation. It tries to read the file content as if it were a file itself. Passing the file name also results in invalid key. ``` connection { type = "ssh" host = aws_instance.example[0].public_ip user = "ec2-user" private_key =var.ssh_key_file_path } ``` **The documentation says** > private_key - The contents of an SSH key to use for the connection. These can be loaded from a file on disk using the file function. This takes preference over the password if provided. **Question** Has this behavior been modified? Or Am I missing something ### Terraform Version ``` Terraform v0.14.4 + provider registry.terraform.io/hashicorp/aws v3.28.0 + provider registry.terraform.io/hashicorp/local v2.1.0 + provider registry.terraform.io/hashicorp/null v3.1.0 + provider registry.terraform.io/hashicorp/random v3.0.1 + provider registry.terraform.io/hashicorp/template v2.2.0 Your version of Terraform is out of date! The latest version is 0.14.10. You can update by downloading from https://www.terraform.io/downloads.html ``` ### Terraform Configuration Files NA ### Debug Output **Output:** Error: stat -----BEGIN PRIVATE KEY----- . . . -----END PRIVATE KEY----- : no such file or directory ### Crash Output NA ### Expected Behavior Terraform should accept file content for SSH certificate ### Actual Behavior Rejects file name as it interprets it as a key content and tries to read content if I pass the actual output from file() function. ### Steps to Reproduce 1. Create terraform file with the sample content above 2. Apply the file to AWS or other cloud with SSH ### Additional Context ### References
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.