Using terraform to create, deploy and host my amplify app


Hi, I am trying to create, deploy and host my amplify app using terraform. I am writing the following code to create and host my app.

Create the Amplify app

resource "aws_amplify_app" "SelfServiceDashboard" { name = "SelfServiceDashboard" }

Create the Amplify backend environment

resource "aws_amplify_backend_environment" "SelfServiceDashboard" { app_id = environment_name = "prod" stack_name = "awscloudformation" # Replace with the desired CloudFormation stack name }

Initialize the Amplify project

resource "null_resource" "initialize_amplify_project" { provisioner "local-exec" { command = "amplify init --appId ${}" } }

Pull the existing Amplify project (if it exists)

resource "null_resource" "pull_amplify_project" { depends_on = [null_resource.initialize_amplify_project]

provisioner "local-exec" { command = "amplify pull --appId ${} --envName prod" } }

Trigger the backend environment deployment

resource "null_resource" "trigger_backend_deployment" { depends_on = [aws_amplify_backend_environment.SelfServiceDashboard, null_resource.pull_amplify_project]

provisioner "local-exec" { command = "amplify push --appId ${} --envName prod" } } but the hosting environment is never deployed, it just says this

Waiting to deploy Your deployment is being queued...

could you please help me with the code or guide as to what I am doing wrong here

1 Answer


The issue can occur due to multiple reasons such as permission issues or the “amplify publish” command not executing completely. Could you kindly confirm with us if you are observing any error, especially for the “amplify publish” or “amplify push” command.

The command “amplify push” will build all your local backend resources and provision it in the cloud. Whereas, “amplify publish” will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud. Hence, in order to start the deployment for the hosting environment we need to execute “amplify publish” command.

Should you be facing any errors, it is suggested to delete the deployment that was stuck and start the deployment again. The steps for deploying Amplify with Terraform can be found here:

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions