Open MastalerzKamil opened 2 years ago
Doesn't it already output the preview url? https://github.com/milliHQ/terraform-aws-next-js/blob/main/packages/tf-next/src/commands/deploy/deploy.ts#L110
Yes it is but I would like to take it and save into secrets in my CI/CD. I know that I could copy it manually but I need make deployment wit changing alias automatically. Based on documentation https://registry.terraform.io/modules/milliHQ/next-js/aws/1.0.0-canary.5. There isn't an output as url or deployment Id
It seems the project is stale...it's a pity...not usable in the real world without getting a deployment id. Only for manual deployments.
Yeah Vercel poached our dear boy. I'd recommend using sst.dev
for your infra and NextjsSite v2 for your nextjs app. It supports latest Nextjs features. https://discord.gg/sst
I made this construction:
resource "null_resource" "tf-next-deploy-and-promote" {
provisioner "local-exec" {
command = "tf-next deploy --endpoint=${module.tf_next.api_endpoint} | grep -oP '(?<=\\/\\/)(.*?)(?=undefined)' | xargs -I {} tf-next alias set ${aws_route53_record.main.fqdn} {} --force"
working_dir = "../." #because next.js in parent folder
}
}
In my case, tf-next deploy throws "HTTP://1234141124(some_id)123141234undefined" instead of URL. That's why I used regex '(?<=\/\/)(.*?)(?=undefined)'
I'm going to use
tf-next
into Github Action CI/CD and based on README in order to switch alias I need to havedaployment-id
orurl
to deployed app. Is there any way to get it as an output from commandtf-next deploy
?