Skip to content

String parameters being interpreted as scientific notation #124

Open
@jonnyry

Description

@jonnyry

Issue Description

When passing string parameters that resemble scientific notation (e.g., "51e7") through the Porter Terraform mixin, they are being incorrectly converted to their decimal representation (e.g., "510000000"). This happens even when the parameters are properly defined as type: string in the Porter manifest and are quoted in the command line.

Steps to Reproduce

Porter.yaml

---
schemaVersion: 1.0.0
name: porter-scientific-test
version: 0.1.0
description: "A test bundle to demonstrate scientific notation string conversion issue"
dockerfile: Dockerfile.tmpl
registry: azuretre

parameters:
  - name: test_id
    type: string
    description: "Test ID that looks like scientific notation"

mixins:
  - exec
  - terraform:
      clientVersion: 1.10.3

install:
  - terraform:
      description: "Test parameter handling"
      vars:
        test_id: ${ bundle.parameters.test_id }

main.tf

# main.tf

terraform {
  required_providers {
    null = {
      source = "hashicorp/null"
      version = "~> 3.0"
    }
  }
}

variable "test_id" {
  type = string
}

output "test_id_output" {
  value = var.test_id
}

Running the test

porter install --param test_id="51e7"

Output

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Changes to Outputs:
  + test_id_output = "510000000"

You can apply this plan to save these new output values to the Terraform
state, without changing any real infrastructure.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

test_id_output = "510000000"
execution completed successfully!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions