diff --git a/infrastructure/terraform/components/app/amplify_branch_deploy.tf b/infrastructure/terraform/components/app/amplify_branch_deploy.tf new file mode 100644 index 0000000..b279061 --- /dev/null +++ b/infrastructure/terraform/components/app/amplify_branch_deploy.tf @@ -0,0 +1,12 @@ +resource "null_resource" "amplify_branch_deploy" { + # Using triggers to force execution on every apply + triggers = { + always_run = timestamp() + } + + depends_on = [module.amplify_branch] + + provisioner "local-exec" { + command = "aws amplify start-job --app-id ${aws_amplify_app.main.id} --branch-name ${var.branch_name} --commit-message \"${replace(var.deployment_description, "\"", "\\\"")}\" --commit-id ${var.commit_id} --job-type RELEASE" + } +} diff --git a/infrastructure/terraform/components/app/variables.tf b/infrastructure/terraform/components/app/variables.tf index eda7050..52cb0ad 100644 --- a/infrastructure/terraform/components/app/variables.tf +++ b/infrastructure/terraform/components/app/variables.tf @@ -99,8 +99,20 @@ variable "branch_name" { default = "main" } +variable "commit_id" { + type = string + description = "The commit to deploy. Must be in the tree for branch_name" + default = "HEAD" +} + +variable "deployment_description" { + type = string + description = "A message describing the deployment" + default = "Deploy HEAD" +} + variable "disable_content" { type = string - description = "Value for turning switching disable conten true/false" + description = "Value for turning switching disable content true/false" default = "false" }