Open mattk-ce opened 3 years ago
I run into the same issue when I use the AWS_CLI and need to run a start-job
after a create-branch
.
aws amplify create-branch --app-id exampleappid --branch-name dev --description dev --stage DEVELOPMENT --framework "Next.js - SSR" --no-enable-notification --enable-auto-build --no-enable-basic-auth --no-enable-performance-mode --ttl 5 --display-name dev --no-enable-pull-request-preview
aws amplify start-job --app-id exampleappid --branch-name dev --job-type RELEASE
I've read through the AWS Go SDK docs and think the following acceptance criteria would work. Forgive me for not doing a pull-request, I'm not a very confident dev so hoping someone will the skills will be able to pick-up.
Given an aws_amplify_branch resource is planned to be created
And enable_auto_build is set to true
When func (*Amplify) CreateBranch
is successful
Then func (*Amplify) StartJob
is run
And AppId equals the aws_amplify_branch's app_id
And BranchName equals the aws_amplify_branch's branch_name
And JobType equals JobTypeRelease
(JobTypeRelease = "RELEASE")
Same here, enable_auto_build=true
is not helping
Sharing my findings on this issue.
For me root of the issue was that I copy pasted a url from github
in the following format https://github.com/hashicorp/terraform-provider-aws.git
(notice .git in the end)
❗ main.tf
that does not trigger builds
resource "aws_amplify_app" "example" {
name = "example"
repository = "https://github.com/hashicorp/terraform-provider-aws.git"
}
removing .git
from url solved the issue for me.
✅ main.tf
that triggers builds
resource "aws_amplify_app" "example" {
name = "example"
repository = "https://github.com/hashicorp/terraform-provider-aws"
}
@yuyokk Thanks. Removing .git
helps.
enable_auto_build still does nothing on initial creation of the branch (it doesn't trigger a build). Removing .git doesn't help that either.
enable_auto_build still does nothing on initial creation of the branch (it doesn't trigger a build). Removing .git doesn't help that either.
Same here. I tried:
My environment NextJS 13 SSR
Does enable_auto_build mean building the app on terraform apply? It looks some could make it but I do not see why it's not working on my end... Can anyone help with this?
enable_auto_build still does nothing on initial creation of the branch (it doesn't trigger a build). Removing .git doesn't help that either.
Same here. I tried:
- Admin access for IAM so the policy is "Action": "*" which should allow anything but no luck. It says it is stuck 'your build is queued'.
- I use the URL without git.
- If I push a change to the branch then it triggers build and successfully deployed. Yes, the website is up and running. (the build command is fine)
My environment NextJS 13 SSR
Does enable_auto_build mean building the app on terraform apply? It looks some could make it but I do not see why it's not working on my end... Can anyone help with this?
same here, always get "Your build is being queued. If your build has not started in over a minute, click the button below." It works only if I click the build button manually.
Any update on this
I was able to force an initial build by adding the following:
resource "null_resource" "trigger_amplify_deployment" {
depends_on = [aws_amplify_branch.main]
# Force this command to be triggered every time this terraform file is ran
triggers = {
always_run = "${timestamp()}"
}
# The command to be ran
provisioner "local-exec" {
command = "aws amplify start-job --app-id ${aws_amplify_app.example.id} --branch-name ${aws_amplify_branch.main.branch_name} --job-type RELEASE"
}
}
Community Note
Affected Resource(s)
aws_amplify_app aws_amplify_branch
Expected Behavior
When specifying
enable_auto_build
, a build should be triggered when the branch is provisioned.Actual Behavior
A build is not triggered