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

String parameters being interpreted as scientific notation #124

Open
jonnyry opened this issue Jan 16, 2025 · 0 comments
Open

String parameters being interpreted as scientific notation #124

jonnyry opened this issue Jan 16, 2025 · 0 comments

Comments

@jonnyry
Copy link
Contributor

jonnyry commented Jan 16, 2025

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!
@jonnyry jonnyry changed the title String parameters being interpreted as scientific notation in Terraform mixin String parameters being interpreted as scientific notation Jan 16, 2025
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

No branches or pull requests

1 participant