Question: Your company has started using AWS and needs an EC 2 instance containing generated SSH keys. Your task is to prepare its configuration terraform Requiremens
Your company has started using AWS and needs an EC instance containing generated SSH keys. Your task is to prepare its configuration terraform
Requiremens
Add the following providers to your solution using terraform
a syntax:
b localversion
i tlsversion
Reference the above providers in your solution via the provider keyword and add their configuration if required
Don't add any more providers
Use the correct resource from the tls provider to generate private and public SSH keysRSA bit using one of the aforementioned providers. the name of this resource should be sshkey
Use the correct resource from local provider to generate cloudconfig.yaml by rendering cloudconfig.yaml.tpl and filling placeholders with following keys:
a Publickey with the result of creating the public key
b privatekey with the result of creating the private key the name of this resource should be cloudconfig. Remember to use correct indentation
Assumptions
For this task assume that:
You don't need to write any code to setup any resources in AWS
cloudconfig.yaml.tpl follows precisely the following formatDont copy it assume it is located in the same directory as cloudconfig.yaml.tpl Simply read it:
#cloudconfig.yaml.tpl
writefiles:
path: etcappkey
permissions:
content:
$privatekey
path: etcappkeypub
permissions:
content:
$publickey
Indention in the YAML file are four single spaces
the version of terraformin use
Hints
Do not use deprecated terraform syntax; eg use var.whatever instead of $varwhatever
Use template functions in place of deprecated template provider
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
