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

Float and bool values are changed to int #452

Open
Mistic92 opened this issue Apr 26, 2023 · 6 comments
Open

Float and bool values are changed to int #452

Mistic92 opened this issue Apr 26, 2023 · 6 comments
Labels
impact/reliability Something that feels unreliable or flaky kind/bug Some behavior is incorrect or out of spec

Comments

@Mistic92
Copy link

What happened?

In Pulumi.develop.yaml I have values like below

  cloud_run:APP_USE_PPROF: "false"
  cloud_run:APP_TRACE_SAMPLING_RATE: "0.01"

In Pulumi.yaml I'm using them in GCP Cloud Run service

      containers:
          - envs:
              - name: APP_TRACE_SAMPLING_RATE
                value: ${cloud_run:APP_TRACE_SAMPLING_RATE}
              - name: APP_USE_PPROF
                value: ${cloud_run:APP_USE_PPROF}

When I do pulumi up float values are converted to int so my 0.01 is 0.
I found out that using , instead of . does not change value so 0,01 give 0,01 but my app won't handle that.

Also bool values are converted from false/true to 0/1.

Expected Behavior

Support float and don't change bool to int.

Steps to reproduce

Use Pulumi YAML with GCP Cloud Run service.

Output of pulumi about

╰─ pulumi about                                                                                                                                                                                                                            ─╯
CLI          
Version      3.64.0
Go Version   go1.20.3
Go Compiler  gc

Plugins
NAME  VERSION
yaml  unknown

Host     
OS       ubuntu
Version  20.04
Arch     x86_64

This project is written in yaml

Current Stack: XXXXXXXX/usage-reporter/develop

TYPE                                URN
pulumi:pulumi:Stack                 urn:pulumi:develop::usage-reporter::pulumi:pulumi:Stack::usage-reporter-develop
pulumi:providers:gcp                urn:pulumi:develop::usage-reporter::pulumi:providers:gcp::default
gcp:serviceAccount/account:Account  urn:pulumi:develop::usage-reporter::gcp:serviceAccount/account:Account::usagereporter-sa-svc
gcp:cloudrun/service:Service        urn:pulumi:develop::usage-reporter::gcp:cloudrun/service:Service::usagereporter-cloudrun-svc
gcp:cloudrun/iamBinding:IamBinding  urn:pulumi:develop::usage-reporter::gcp:cloudrun/iamBinding:IamBinding::usagereporter-sa-binding


Found no pending operations associated with XXXXXXXX/develop

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/lbyjos
User           lbyjos
Organizations  lbyjos, XXXXXXXX

No dependencies found

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@Mistic92 Mistic92 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 26, 2023
@Mistic92
Copy link
Author

After manual edit of Cloud Run service in GCP Console, refresh I'm doing pulumi up and it tries to change this values again.

          ~ spec    : {
              ~ containers: [
                  ~ [0]: {
                          ~ envs: [
                              ~ [1]: {
                                      + name : "APP_TRACE_SAMPLING_RATE"
                                      + value: 0
                                    }
                              ~ [3]: {
                                      - name : "APP_TRACE_SAMPLING_RATE"
                                      - value: "0.01"
                                    }
                              ~ [7]: {
                                      ~ name : "APP_USE_PPROF" => "APP_USE_PPROF"
                                      ~ value: "false" => false
                                    }
                            ]
                        }
                ]
            }
        }

After accepting changes APP_USE_PPROF is changed to 0...

@abhinav abhinav added impact/reliability Something that feels unreliable or flaky and removed needs-triage Needs attention from the triage team labels Apr 28, 2023
@jamest-gaia
Copy link

Not sure if this is the same or different to #453

@aq17
Copy link
Contributor

aq17 commented May 26, 2023

@Mistic92 curious if you're using project level configuration? If so, you should be able to declare the desired type of your config values

@jamest-gaia
Copy link

jamest-gaia commented Jun 1, 2023

@aq17 I don't know whether the OP was, but I already tried that (see #453) and it makes no difference. The only thing that worked for me was defining the values like this

cloud_run:APP_USE_PPROF: |-
  "false"
cloud_run:APP_TRACE_SAMPLING_RATE: |-
  "0.01"

which seems to force Pulumi to treat them as strings. I don't know if this trick would work for the OP though, since my problem was slightly different - I was trying to define values in the config, and pulumi was converting them into types like boolean and integer, when the provider actually wanted strings.

@Mistic92
Copy link
Author

Mistic92 commented Jun 1, 2023

We are using stack configuration scope. We have moved back to Go as after 3 weeks there was no update on this bug. Maybe we'll try again to use yaml in the future.

@jamest-pin
Copy link

I'm now having this problem again but (sort of) in reverse. I have values I need to be bool but they're being converted to strings. I tried all the same tricks as above. Very frustrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/reliability Something that feels unreliable or flaky kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

5 participants