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

If no subnet strategy specified, you get the "outputs are not strings" error message #1372

Closed
pierskarsenbarg opened this issue Sep 4, 2024 · 4 comments · Fixed by #1374 or #1395
Closed
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@pierskarsenbarg
Copy link
Member

What happened?

I didn't add a subnet_strategy input to my VPC and got the following warning message:

warning: The default subnetStrategy will change from "Legacy" to "Auto" in the next major version. Please specify the subnetStrategy explicitly. The current subnet layout can be specified via "Auto" as:

    "Calling [toJSON] on an [Output<T>] is not supported.\n\nTo get the value of an Output as a JSON value or JSON string consider either:\n    1: o.apply(v => v.toJSON())\n    2: o.apply(v => JSON.stringify(v))\n\nSee https://www.pulumi.com/docs/concepts/inputs-outputs for more details.\nThis function may throw in a future version of @pulumi/pulumi."

which suggests that we're trying to write out an output as a string.

Example

import pulumi_aws as aws
import pulumi_awsx as awsx

vpc = awsx.ec2.Vpc("gpu-vpc",
          cidr_block="10.0.0.0/16",
          subnet_specs=[awsx.ec2.SubnetSpecArgs(
              type=awsx.ec2.SubnetType.PUBLIC,
              name="gpu-public"
          )],
          nat_gateways=awsx.ec2.NatGatewayConfigurationArgs(
              strategy=awsx.ec2.NatGatewayStrategy.NONE
          ),
        #   subnet_strategy=awsx.ec2.SubnetAllocationStrategy.AUTO
          )

(note the subnet strategy line is commented out)

Output of pulumi about

CLI
Version      3.130.0
Go Version   go1.22.6
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  aws     6.50.1
resource  awsx    2.14.0
resource  docker  4.5.5
language  python  unknown

Host
OS       darwin
Version  14.6.1
Arch     arm64

This project is written in python: executable='/Users/piers/go/src/github.com/pierskarsenbarg/demos/python-ecs-gpu/venv/bin/python' version='3.12.5'

Current Stack: demo/python-ecs-gpu/dev

Found no resources associated with demo/dev

Found no pending operations associated with demo/dev

Backend
Name           pulumi.com
URL            https://app.pulumi.com/pierskarsenbarg
User           pierskarsenbarg
Organizations  pierskarsenbarg, team-ce, gitlab-test-piers, demo
Token type     personal

Dependencies:
NAME         VERSION
pip          24.2
pulumi_awsx  2.14.0
setuptools   74.1.1
wheel        0.44.0

Pulumi locates its logs in /var/folders/x8/cdd9j87s607fwpy0q62mfmmw0000gn/T/ 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).

@pierskarsenbarg pierskarsenbarg added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Sep 4, 2024
@mikhailshilkov mikhailshilkov self-assigned this Sep 4, 2024
@mikhailshilkov mikhailshilkov removed the needs-triage Needs attention from the triage team label Sep 4, 2024
t0yv0 pushed a commit that referenced this issue Sep 4, 2024
We can't use JSON.stringify on an output directly, we need to do that
inside an apply.

Fix #1372
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Sep 4, 2024
@pulumi-bot

This comment has been minimized.

@MitchellGerdisch
Copy link

I'm seeing this issue in release 2.16.1

@pierskarsenbarg
Copy link
Member Author

pierskarsenbarg commented Oct 11, 2024

This wasn't fixed in v2.15.0 either

If it helps, I'm now seeing this as a warning:

warning: The default subnetStrategy will change from "Legacy" to "Auto" in the next major version. Please specify the subnetStrategy explicitly. The current subnet layout can be specified via "Auto" as:

    [
      {
        "cidrMask": "Calling [toJSON] on an [Output<T>] is not supported.\n\nTo get the value of an Output as a JSON value or JSON string consider either:\n    1: o.apply(v => v.toJSON())\n    2: o.apply(v => JSON.stringify(v))\n\nSee https://www.pulumi.com/docs/concepts/inputs-outputs for more details.\nThis function may throw in a future version of @pulumi/pulumi.",
        "type": "Calling [toJSON] on an [Output<T>] is not supported.\n\nTo get the value of an Output as a JSON value or JSON string consider either:\n    1: o.apply(v => v.toJSON())\n    2: o.apply(v => JSON.stringify(v))\n\nSee https://www.pulumi.com/docs/concepts/inputs-outputs for more details.\nThis function may throw in a future version of @pulumi/pulumi."
      }
    ]

@mikhailshilkov mikhailshilkov removed the resolution/fixed This issue was fixed label Oct 11, 2024
mikhailshilkov added a commit that referenced this issue Oct 15, 2024
Another fix for #1372 while
#1374 only partially
succeeded.

The previous attempt was successful in resolving the top-level output
but child outputs were still unresolved. I was a bit surprised that was
the case... outputs are hard!

The new attempt relies on `pulumi.jsonStringify` which is made exactly
for this purpose. This drops JSON formatting but hopefully that not too
bad for a small JSON. Example of the result:

```
 warning: The default subnetStrategy will change from "Legacy" to "Auto" in the next major version. Please specify the subnetStrategy explicitly. The current subnet layout can be specified via "Auto" as:
    
    [{"cidrMask":20,"type":"Public"}]
```
@mikhailshilkov mikhailshilkov added the resolution/fixed This issue was fixed label Oct 15, 2024
@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #1395 and shipped in release v2.17.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
4 participants