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

Pulumi unable to serialize non-integers(?) #694

Closed
chrsmith opened this issue Dec 11, 2017 · 0 comments · Fixed by pulumi/pulumi-terraform#88
Closed

Pulumi unable to serialize non-integers(?) #694

chrsmith opened this issue Dec 11, 2017 · 0 comments · Fixed by pulumi/pulumi-terraform#88
Milestone

Comments

@chrsmith
Copy link
Contributor

I'm seeing the following behavior: Pulumi is applying integer rounding before updating resources.

Repro. (I assume the AWS component isn't required.)

const alarmArgs: aws.cloudwatch.MetricAlarmArgs = {
    name: "bug repro",
    alarmDescription: "",
    actionsEnabled: true,
    alarmActions: [],
    namespace: "AWS/ApplicationELB",
    metricName: "TargetResponseTime",
    dimensions: {
        "TargetGroup": "NA",
        "LoadBalancer": "NA",
    },
    statistic: "Average",
    evaluateLowSampleCountPercentiles: undefined,
    treatMissingData: "ignore",
    comparisonOperator: "GreaterThanThreshold",
    evaluationPeriods: 1,
    period: 60,

    // I really need this to be a floating point value.
    threshold: 2.9,
};

let tooHighLatencyAlarm = new aws.cloudwatch.MetricAlarm(
    "bug-repro", alarmArgs,
    undefined, []);

If you set alarmArgs.threshold to be any non-integer, the Pulumi update creates/updates the resource with the integer value.

e.g. the diff looks like:

setting threshold to 0.5, created with value 0.

setting threshold to 1.1

        statistic         : "Average"
      - threshold         : 0
      + threshold         : 1
        treatMissingData  : "ignore"

setting threshold to 2.9

        statistic         : "Average"
      - threshold         : 1
      + threshold         : 2
        treatMissingData  : "ignore"
@chrsmith chrsmith added this to the 0.9.1 milestone Dec 11, 2017
@joeduffy joeduffy modified the milestones: 0.9.1, 0.9.2 Dec 12, 2017
joeduffy added a commit to pulumi/pulumi-terraform that referenced this issue Dec 20, 2017
Our support for Terraform schema mapping currently assumed that
all numbers became integers.  There is, however, a schema.TypeFloat
that we should recognize and use to project numbers as floats.

This fixes pulumi/pulumi#694.
joeduffy added a commit to pulumi/pulumi-terraform that referenced this issue Dec 20, 2017
Our support for Terraform schema mapping currently assumed that
all numbers became integers.  There is, however, a schema.TypeFloat
that we should recognize and use to project numbers as floats.

This fixes pulumi/pulumi#694.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants