https://pulumi.com logo
Title
r

rich-motorcycle-71684

03/27/2023, 12:54 AM
Hi Everyone, I cannot get to the bottom of this. A string is being converted to an integer, or something like that - resulting in leading zero being stripped. I've tried double quoting it, single quoting it. Any advice appreciated. my
Pulumi.develop.yaml
file
config:
  aws:profile: 028111111111_AWSAdministratorAccess
  aws:region: ap-southeast-2
  myprojectname:aws_account_id: "028111111111"
  myprojectname:dns_domain: "redacted"
  myprojectname:aws_route53_zoneid: "redacted"
When I attempt to use this value
aws_account_id
in the code, it strips the zero. The stripping doesn't happen to the
aws:profile
. Perhaps because it contains some alpha characters too, or perhaps because the aws provider handles the variable differently. This is where I tried to use it (in an IAM policy)
# Allow to send emails with SES.
            - Action:
                - ses:SendEmail
              Effect: Allow
              Resource: "*" # "arn:aws:ses:${aws:region}:${aws_account_id}:identity/${ses_DomainIdentity.domain}" # can't use this due to bug with yaml stripping leading 0 from aws_account_id
s

salmon-account-74572

03/27/2023, 2:22 PM
Do you have a reference to that configuration value in the
config
block of your
Pulumi.yaml
file? If so, you can specify a
type
property there (set it to “string”), and that may help resolve the issue.
r

rich-motorcycle-71684

03/28/2023, 4:11 AM
@salmon-account-74572 thanks for the suggestion. I didn't know I needed a
config
section in
Pulumi.yaml
. I'll look into that
@salmon-account-74572 I tried that, perhaps I'm missing something simple. So this value
aws_account_id
is different for each stack hence its original location in the stack files i.e.
Pulumi.develop.yaml
,
Pulumi.staging.yaml
etc. I tried to implement your suggestion by adding a couple of lines under
config:
at the top of
Pulumi.yaml
like so:
config:
...
  aws_account_id:
    type: string
Then I printed the output like so:
outputs:
  # Debug printouts
  accIDString: "${aws_account_id}"
And it's still getting converted.
Outputs:
  + accIDString               : 2.809102044e+10
I also tried a slightly different way, but this just printed the variable name
config:
  awsAccountID: 
    type: string
    default: ${aws_account_id}
...
outputs:
  # Debug printouts
  accIDString: "${awsAccountID}"
~~~~~~~~
Outputs:
  + accIDString               : "${aws_account_id}"
b

billowy-army-68599

03/28/2023, 1:35 PM
@rich-motorcycle-71684 this looks like a bug, could you file an issue?
r

rich-motorcycle-71684

05/02/2023, 1:08 AM