Comments (8)
Is this still needed?
With the release of v0.8.0
it is now possible to use count
on the module like this:
module "next-tf" {
source = "dealmore/next-js/aws"
count = terraform.workspace == "prod" ? 1 : 0
}
from terraform-aws-next-js.
Do you have a specific resource in mind?
My philosophy here is to support optional resources when they are not necessary or can be replaced with self-written constructs.
The next optional resource to add will be the main CloudFront distribution, which is targeted in #55.
IMHO I currently don't see other resources where this would make sense, but I am open for suggestions π
from terraform-aws-next-js.
@ofhouse In many use cases, one Terraform code covers multiple environments. For example, in the code below, I would like to decide to create the next-tf module according to the environment.
module "next-tf" {
source = "dealmore/next-js/aws"
create = terraform.workspace == "prod"
// or
// create = var.env == "prod"
next_tf_dir = var.next_tf_dir
deployment_name = var.deployment_name
}
This pattern can be used in many modules, including the following two modules used by this module:
- https://github.com/terraform-aws-modules/terraform-aws-apigateway-v2
- https://github.com/terraform-aws-modules/terraform-aws-lambda
from terraform-aws-next-js.
My philosophy here is to support optional resources when they are not necessary or can be replaced with self-written constructs.
This can also be achieved by just using var.create && var.create_xxx
. Example:
resouce "aws_cloudfront_distribution" "this" {
count = var.create && var.create_cloudfront_distribution ? 1 : 0
}
from terraform-aws-next-js.
Ah, thanks for clarification.
I think the create
variables there were originally added for versions of Terraform below 0.13
since it was not possible to use count
or for_each
on modules.
Terraform 0.13
(which is already the minimal required version for this module) and up support count
on modules which I would prefer here since it is an official Terraform feature and no workaround like a create
variable would be.
However, using count on this module currently does not work because we use an internal AWS provider to ensure that some resources are created in us-east-1
region. #50
The plan is to drop this internal provider in the next version which should lift the limitation on using count
.
from terraform-aws-next-js.
You're right. Using count
in module, blocks the use of provider inside the module, I think the create
variable is still useful in many cases.
from terraform-aws-next-js.
Would like to reevaluate this after #50 is implemented.
Introducing a create variable would require a lot of changes and it must also be ensured that the submodules support it.
For this reason I would appreciate it when this could be handled in userland with a simple count on the module itself.
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)
- This site canβt be reached HOT 1
- 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
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.