Skip to content
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

Evaluate var.create variable to set count to 1 or 0 #62

Conversation

jordiclariana
Copy link
Contributor

In order to avoid hashicorp/terraform#18195

@antonbabenko
Copy link
Member

I don't think this is necessary. Please try to run examples/disabled on your local setup.

@jordiclariana
Copy link
Contributor Author

The examples work, and is not the point of the issue in terraform. The problem is when create parameter is a result of evaluating a ternary, like this: create = ${true ? true : false}. Then it will fail.

@jordiclariana
Copy link
Contributor Author

jordiclariana commented Jun 6, 2018

From the examples/disabled, notice that I changed the create line:

  region = "eu-west-1"
}

#############################################################
# Data sources to get VPC and default security group details
#############################################################
data "aws_vpc" "default" {
  default = true
}

data "aws_security_group" "default" {
  name   = "default"
  vpc_id = "${data.aws_vpc.default.id}"
}

########################################################
# Security groups WILL NOT be created by these examples
########################################################
module "complete_sg_disabled" {
  source = "../../"

  create      = "${true ? false: false}"
  name        = "complete-sg"
  description = "Security group with all available arguments set (this is just an example)"
  vpc_id      = "${data.aws_vpc.default.id}"

  ingress_cidr_blocks = ["0.0.0.0/0"]
}

This produces this:


* module.complete_sg_disabled.aws_security_group.this: cannot parse "false" as an integer

@antonbabenko
Copy link
Member

Jordi, thanks for this PR and for making this module a bit more forward-compatible with the upcoming version of Terraform! :)

@antonbabenko antonbabenko merged commit ed85a2f into terraform-aws-modules:master Jun 20, 2018
@antonbabenko
Copy link
Member

v2.1.0 has been released.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants