Deploying to AWS using Terraform during build


#1

I’m currently running a build which is using Terraform to deploy to AWS. As I need the concept of ‘profiles’ locally as I have multiple accounts, I need to incorporate this into my build, and my build scripts use the AWS profile I select.

Unfortunately this means currently I am getting an error in the build because it says I have not set a profile. In the Circle UI, under Projects > Settings > AWS Permissions, I am defining my access and secret key which I wish to use.

It says:

Set the AWS keypair to be used for authenticating against AWS services during your builds. Credentials are installed on your containers into the ~/.aws/config and ~/.aws/credentials properties files. These are read by common AWS libraries such as the Java SDK, Python's boto, and the Ruby SDK.

This is exactly what I want, because it would put the creds I have specified in the correct .aws location as well as having a ‘default’ profile, which I can tell my build to use. However, when I SSH onto the build box upon failure, those creds files aren’t there and they only seem to be stored as env vars. I wondered if there is anything I need to do to have them available within the files like it says?

There’s a few ways I can solve my problem, such as using aws configure set, but if there’s something noddy which would get my creds in the ~/.aws/config and ~/.aws/credentials files then that would be idea.

Any ideas?


#2

Is your build running on 1.0 or 2.0?


#3

I’m running 2.0, is that the issue?


#4