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

providers/template: template_file supports floating point math #8590

Merged
merged 1 commit into from
Sep 1, 2016

Conversation

mitchellh
Copy link
Contributor

Fixes #7887

This adds a special case to detect numbers as floating point variables and converts them to floats. This allows floating point math to work.

@jbardin
Copy link
Member

jbardin commented Sep 1, 2016

LGTM

@mitchellh mitchellh merged commit 1b5d7cd into master Sep 1, 2016
@mitchellh mitchellh deleted the b-template-floats branch September 1, 2016 03:00
@phinze
Copy link
Contributor

phinze commented Sep 2, 2016

This is unfortunately not a transparent change.

resource "template_file" "iam_policy" {
  template = "${file("${path.module}/templates/iam_policy.json.tpl")}"
  vars {
    region            = "${var.region}"
    owner_id          = "${aws_security_group.lab.owner_id}"
  }
}

This template is getting rendered as owner_id = "1.453785634567e+11"

@sethvargo
Copy link
Contributor

sethvargo commented Sep 2, 2016

This breaks when the value is a bigint. It overflows and you get sadness like 1.453785634567e+11, which is actually a bigint owner_id from AWS.

@ghost
Copy link

ghost commented Apr 22, 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 22, 2020
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.

Variable interpolation doesn't work for floats
4 participants