1
votes

I am creating a user account in AWS via terraform that will need access to a AWS CodeCommit repository. I would like the user to be able to access CodeCommit over HTTPS, but I have not been unable to find a way to generate / set the HTTPS Git credentials for the user through terraform.

I am currently working around this by using the aws_iam_user_ssh_key resource to upload a public key and having the user interact with CodeCommit over SSH.

Does someone know how to generate HTTPS Git credentials with terraform?

1

1 Answers

1
votes

If you set up the AWS CLI before you clone your repository, then run:

git config --global credential.helper '!aws codecommit credential-helper $@'

git config --global credential.UseHttpPath true

You should be able to use CodeCommit with HTTP using temporary signature based credentials generated by the CodeCommit credential helper (provided that the system you are deploying to will not try to cache these temporary credentials).

This also avoids the need to check in any static credentials via code if you are using HTTPS Git credentials.