-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create
variable
#78
Comments
Do you have a specific resource in mind? The next optional resource to add will be the main CloudFront distribution, which is targeted in #55. |
@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: |
This can also be achieved by just using resouce "aws_cloudfront_distribution" "this" {
count = var.create && var.create_cloudfront_distribution ? 1 : 0
} |
Ah, thanks for clarification. Terraform 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 |
You're right. Using |
Would like to reevaluate this after #50 is implemented. For this reason I would appreciate it when this could be handled in userland with a simple count on the module itself. |
Is this still needed? module "next-tf" {
source = "dealmore/next-js/aws"
count = terraform.workspace == "prod" ? 1 : 0
} |
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. |
many terraform module support
create
orcreate_xx
variables to controls whether resource should be created. I think, one of the reasons for doing this is, it's hard to usecount
orfor_each
in module block.terraform-aws-next-js
also hascreate_domain_name_records
andcreate_image_optimization
. But no option to skip for other resources.Do you have any plans to add a
create
variable that controls the creation of the entire resource? Or can I create a PR?The text was updated successfully, but these errors were encountered: