Agent Install using Terraform

Do we install agent when deploying instances via spec templates?

It’s the terraform code that creates AWS infrastructure - VPC, Subnet, security group and instance from scratch, and trying to then execute ansible workflow on the same.

Also, if I do not use the Morpheus agent bus and would like to instead use SSH key, then which key it picks up and where can we define the key? So the keypair I have mentioned in the terraform code is an existing keypair that has been created and downloaded from AWS, and same has been uploaded in Morpheus.

The ansible workflow execution throws error Permission denied (publickey)

It’s probably the username Morpheus is trying to connect as

you can inject the agent install into the tf 
    user_data = <<-EOF
    - <%=instance.cloudConfig.agentInstall%>

If the instance is created via terraform, we can’t put a username into the virtual-image entry. Not sure how we can force the username from our side except for the ansible inventory, which is dynamic

ah. you can set key_name(s) in tf and aws adds the keys

ok, but either way it should work with agent and ssh both, correct?

I think the issue is the username ties to that key. It could be that the user creating the instance has a username set, but the terraform is setting the key on a default username, like ec2_user. The username used is the RPC user in the host record