Comments (10)
Did you run npx tf-next build
in the root of your Next.js project before running terraform apply
?
Looks like the build output from the tf-next
command (which is stored in .next-tf
directory) is not present.
from terraform-aws-next-js.
This a screenshot of my foulders https://i.imgur.com/tlefhK8.png
it only happened if I used
backend "remote" {
organization = "*****"
workspaces {
name = "*****"
}
}
from terraform-aws-next-js.
Looks like you are using Terraform Cloud for the deployment?
My guess is that the .next-tf
folder is not uploaded correctly to Terraform Cloud and is therefore not present when running terraform apply
.
Looking at your files it seems that your .terraformignore
file is in the wrong place.
It's not very well documented but it should be located in the project root (/.terraformignore
, where your .prettierrc.js
is located) rather than in the terraform subfolder /terraform/.terraformignore
.
Content of the .terraformignore
file should also include the .tf-next
directory as described in the Readme.
from terraform-aws-next-js.
Yes, I'm using Terraform Cloud for the deployment. I'm trying to make it work with AWS and GitHub actions with Terraform. Terraform Cloud is one of the requirement. If you think of another way to do it without the Terraform Cloud. Please let me know.
I tried to add the .terraformignore in the main directory including the .tf-next. But still giving me the same error.
from terraform-aws-next-js.
Interesting we also use Terraform Cloud for an project and it works fine for us.
Do you use the VCS integration or do you execute terraform apply
on the GitHub Actions instance first which triggers a remote apply in Terraform Cloud?
from terraform-aws-next-js.
I'm actually trying to make work locally first. Then move to setup with Github actions but I will execute terraform apply on the GitHub Actions.
from terraform-aws-next-js.
Okay, yes this sounds like a similar approach we are using for our own infrastructure which works fine.
Keep in mind that terraform plan
or terraform apply
do not trigger a build of Next.js by its own.
For a complete deployment you always have to execute npx tf-next build
(which creates a Next.js build and pipes it to the .next-tf
directory) and then terraform plan
or terraform apply
(which picks up some files from the previously generated .next-tf
folder) in this exact order.
Looking at your workflow here I do not see any execution of npx tf-next build
which may is the cause of the error.
from terraform-aws-next-js.
I did before then I removed it again. I got the same error locally. That's why I'm trying to get it to work before pushing it again.
You are welcome to try my repo to see the error by yourself.
from terraform-aws-next-js.
Checked it out locally and the apply was successful in Terraform Cloud for me.
Here are my steps for reproduction:
Setup
Reproduction steps
1. Git checkout
git clone [email protected]:ahmed-rezk-dev/nile-dahsboard.git
git checkout develop
2. Create .terraformignore
file in repo-root with the following content:
# .terraformignore
*
!terraform/
!**/.next-tf/**
3. Install dependencies & run tf-next build
yarn
yarn tf-next
4. Run terraform apply
on Terraform Cloud
cd terraform
terraform init
terraform login
terraform apply
from terraform-aws-next-js.
I'm going to close this issue because it has been inactive for 30 days ⏳. This helps to find and focus on the active issues.
from terraform-aws-next-js.
Related Issues (20)
- Modify proxy to force a version change HOT 1
- Unable to attach policy to lambda, since the iam.tf is missing in all versions starting from 1.0.0-canary.2 HOT 1
- Error: Authentication Failed Returns Status Code 0
- What services does this library use internally to manage deployments? HOT 1
- Unable to use redirect inside getServerSideProps HOT 3
- [Bug] Error while using middleware from Next 12.2 HOT 1
- TimeoutError: Promise timed out after 300000 milliseconds HOT 1
- Question: how can I use this module if I am using Cloudflare for DNS management and WAF? HOT 2
- Dynamic Routes like [id].tsx doesn't be update in my github action
- Q: What permissinos are needed for deployment? HOT 1
- Next.js v13 support HOT 10
- One or more of the CNAMEs you provided are already associated with a different resource. HOT 1
- Cannot deploy - .next-tf/lambdas\__NEXT_PAGE_LAMBDA_0.zip: no such file or directory HOT 1
- Is there a localstack sample available? HOT 1
- Getting Error during creating resources with terraform
- Deployment not deletes old files from s3 HOT 1
- NextAuth CLIENT_FETCH_ERROR , NEXTAUTH_URL
- New deployments not possible due as AWS ACLs are disabled by default HOT 1
- Alternatives? HOT 2
- Lambda functions no longer support NodeJS `v14` . HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-aws-next-js.