title: Pulumi: How to serialize Output<string>[] to JSON
body: <p>I want to allow Lambda service to create a deployment inside my VPC, thus I have subnet ids array of type <code>Output&lt;string&gt;[]</code> that I want to put into role policy as follows:</p>
  
  <pre><code>export const createNetworkInterfacePolicy = new aws.iam.RolePolicy(
    "network-interface-policy-2",
    {
      policy: pulumi.interpolate `{
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Action": ["ec2:CreateNetworkInterfacePermission"],
            "Resource": [
              "arn:aws:ec2:${region}:${callerIdentity.accountId}:network-interface/*"
            ],
            "Condition": {
              "StringEquals": {
                "ec2:Subnet": ${JSON.stringify(vpc.vpcPrivateSubnetIds.map(item =&gt; item.apply(JSON.stringify)))},
                "ec2:AuthorizedService": "lambda.amazonaws.com"
              }
            }
          }
        ]
      }`,
      role: deploymentRole
    }
  );
  </code></pre>
  
  <p>Unfortunately what I end up with is:</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Effect": "Allow",
              "Action": [
                  "ec2:CreateNetworkInterfacePermission"
              ],
              "Resource": [
                  "arn:aws:ec2:us-east-2:removedAccountId:network-interface/*"
              ],
              "Condition": {
                  "StringEquals": {
                      "ec2:Subnet": [
                          "Calling [toJSON] on an [Output&lt;T&gt;] 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 =&gt; v.toJSON())\n    2: o.apply(v =&gt; JSON.stringify(v))\n\nSee https://pulumi.io/help/outputs for more details.\nThis function may throw in a future version of @pulumi/pulumi.",
                          "Calling [toJSON] on an [Output&lt;T&gt;] 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 =&gt; v.toJSON())\n    2: o.apply(v =&gt; JSON.stringify(v))\n\nSee https://pulumi.io/help/outputs for more details.\nThis function may throw in a future version of @pulumi/pulumi."
                      ],
                      "ec2:AuthorizedService": "lambda.amazonaws.com"
                  }
              }
          }
      ]
  }
  </code></pre>
  
  <p>I tried many combinations but none of them work. How do I generate JSON array from <code>Output&lt;string&gt;[]</code>? </p>