How to run an AWS CLI command with local-exec in Terraform cloud?

Is there any way to configure and run a raw AWS CLI command in Terraform Cloud?

I need something not supported by the AWS provider, but normally easily done via the local-exec provisioner with a null resource. However, with Terraform Cloud, the only mechanism I can think of is using the generic way to install additional software then using another local-exec to configure the AWS credentials and defaults.

Since AWS is such a commonly used platform with Terraform, I’m wondering if there’s an easier way to do it? Can the terraform cloud environment come preconfigured with AWS CLI?

Hello @cvrabie!

Right now, we do not have AWS CLI or cloud provider CLIs in the Terraform Cloud runners because we cannot guarantee support for different versions for each type of CLI. For future iterations, we’ve been investigating other implementations to make it easier but installation is the only method available now.

What is the functionality you are looking for? It might be that we could look into supporting directly in the AWS provider.


Thanks for the answer Rosemary. Looking forward to any updates you’ll make in this area.

Both use cases I require are already open tickets. A method to wait until an ECS service has truly been deployed and a way to create a CloudFront invalidation. However based on the discussion on the forum it doesn’t seem to be a lot of appetite for implementing this.

I guess this will always be the case with certain features. This is why a way to send a “raw” aws command could be quite useful.