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

support signum function on interpolation #4853

Closed
jfromaniello opened this issue Jan 27, 2016 · 2 comments
Closed

support signum function on interpolation #4853

jfromaniello opened this issue Jan 27, 2016 · 2 comments

Comments

@jfromaniello
Copy link
Contributor

I have found that most of my cases where I need iterators can be solve with count.index and some math function given a length (modulo is quite useful!).

signum can be useful in the following scenario:

variable "r53_failover_policy" {
    value = "PRIMARY,FAILOVER"
}

resource "aws_route53_record" "rec" {
    count    = "${var.servers}"
    ...
    failover = "%{element(split(",", var.r53_failover_policy), signum(count.index))}"
}

Given than signum returns 0 for 0 and 1 for every positive number, this means that the first one will have PRIMARY the rest will be FAILOVER. This pattern is quite useful for other resources as well.

@radeksimko
Copy link
Member

Implemented in #4854

@ghost
Copy link

ghost commented Apr 27, 2020

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants