1

Question: I am encountering an error while trying to set up my GitLab repository for an AWS Amplify App using Terraform. I have followed the necessary steps, but I keep receiving the following error message during the terraform apply step:

Error: creating Amplify App (amplify-test): BadRequestException: There was an issue setting up your repository. Please try again later. ({"message":"403 Forbidden"})

To provide some context, I am currently using the aws_amplify_app resource from the Terraform Registry. I have generated a personal access token (PAT) in GitLab and provided it during the setup process, but the error persists.

resource "aws_amplify_app" "example" {
  name       = "example"
  repository = var.gitlabrepo

  # GitHub personal access token
  access_token = "..."
}

I suspect that the issue is related to a permission problem or an authorization issue between the Amplify service and GitLab. I would appreciate any guidance or suggestions on how to troubleshoot and resolve this error.

Here are the details of my setup:

Amplify App Details:

App Name: amplify-test Repository Provider: GitLab Personal Access Token (PAT) used: [Insert the PAT you generated] Steps I followed:

Configured the necessary Terraform code for provisioning the Amplify App, using the aws_amplify_app resource from the Terraform Registry. Executed terraform init to initialize the Terraform environment. Executed terraform apply to create the Amplify App. Encountered the aforementioned error during the terraform apply step. If anyone has encountered a similar issue or has any insights into resolving this problem, I would greatly appreciate your assistance. Thank you in advance for your help.

I tried setting up my repository on GitLab for an AWS Amplify App using Terraform. I expected the repository setup to be successful without any errors. However, when I executed the terraform apply command, I received the following error message:

Error: creating Amplify App (amplify-test): BadRequestException: There was an issue setting up your repository. Please try again later. ({"message":"403 Forbidden"})

I generated a personal access token (PAT) in GitLab and provided it during the setup process, expecting it to grant the necessary permissions and resolve any authorization issues. Unfortunately, the error message persisted, indicating a "403 Forbidden" status.

I have also verified that the PAT has the required permissions and followed the recommended steps for setting up the Amplify App using the aws_amplify_app resource from the Terraform Registry.

Despite these efforts, I have been unable to resolve the issue and successfully set up the repository for the Amplify App.

I would appreciate any insights, suggestions, or guidance to troubleshoot and resolve this error. Thank you.

ahmtcnsvr
  • 31
  • 4

1 Answers1

2

after investigation and talking with aws support, unfortunately, by default, AWS Amplify does not support integrating the Gitlab repository via Terraform since GitLab supports repository mirroring and Amplify supports AWS code commit which is AWS's source code versioning system.

As a suggested workaround, you can mirror your GitLab repository to AWS CodeCommit. By doing this, any pushes you make to GitLab will automatically synchronize your changes to CodeCommit for the corresponding branches and trigger the Amplify App to build or re-build. Reference;

https://docs.gitlab.com/ee/user/project/repository/mirror/push.html#set-up-a-push-mirror-from-gitlab-to-aws-codecommit

https://github.com/aws-amplify/amplify-hosting/issues/14

ahmtcnsvr
  • 31
  • 4