pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

api.rootResourceId is not a string

Open dustingraves opened this issue 2 years ago • 3 comments

What happened?

const openAPI = new aws.apigateway.RestApi("openAPI", {})

console.log('id', openAPI.rootResourceId);
Diagnostics:
  pulumi:pulumi:Stack (open-api-infra-dev):
    id OutputImpl {
      __pulumiOutput: true,
      resources: [Function (anonymous)],
      allResources: [Function (anonymous)],
      isKnown: Promise { <pending> },
      isSecret: Promise { <pending> },
      promise: [Function (anonymous)],
      toString: [Function (anonymous)],
      toJSON: [Function (anonymous)]
    }

Steps to reproduce

place this in index.ts

const openAPI = new aws.apigateway.RestApi("openAPI", {})

console.log('id', openAPI.rootResourceId);

run

pulumi up

Expected Behavior

should output a <string>

Actual Behavior

output a prototype

Output of pulumi about

CLI
Version 3.39.3 Go Version go1.19.1 Go Compiler gc

Plugins NAME VERSION aws 5.13.0 docker 3.4.1 nodejs unknown

Host
OS darwin Version 12.4 Arch arm64

This project is written in nodejs: executable='/usr/local/bin/node' version='v14.20.0'

Current Stack: center/dev

TYPE URN pulumi:pulumi:Stack urn:pulumi:dev::open-api-infra::pulumi:pulumi:Stack::open-api-infra-dev pulumi:providers:aws urn:pulumi:dev::open-api-infra::pulumi:providers:aws::default_5_13_0 aws:apigateway/restApi:RestApi urn:pulumi:dev::open-api-infra::aws:apigateway/restApi:RestApi::openAPI aws:apigateway/method:Method urn:pulumi:dev::open-api-infra::aws:apigateway/method:Method::options aws:apigateway/integration:Integration urn:pulumi:dev::open-api-infra::aws:apigateway/integration:Integration::integrationOptions

Found no pending operations associated with center/dev

Backend
Name pulumi.com URL https://app.pulumi.com/Graves User Graves Organizations Graves, center

Dependencies: NAME VERSION @pulumi/awsx 0.40.0 @pulumi/pulumi 3.38.0 @types/node 14.18.26 @pulumi/aws 5.13.0

Pulumi locates its logs in /var/folders/8j/ym2v1bx16_v641wdp7h57pyh0000gr/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).

dustingraves avatar Sep 09 '22 00:09 dustingraves

I believe this is causing a change everytime to my integration because the id is not the same each time so it redeploys.

dustingraves avatar Sep 09 '22 00:09 dustingraves

@dustingraves the restResourceId is an output type: https://www.pulumi.com/docs/intro/concepts/inputs-outputs/ since its not known ahead of time. The output you see is the output type wrapping the string value. If you want to print the resource Id you could do this instead:

const openAPI = new aws.apigateway.RestApi("openAPI", {})

export const rootResourceId = openAPI.rootResourceId;

which should print the string you expect after the resource is created.

Could you provide more details of the actual problem you are seeing around resources changing during redeploys?

viveklak avatar Sep 09 '22 19:09 viveklak

Hi there, Can I work on this issue?

chapaith avatar Sep 10 '22 11:09 chapaith

The described behavior is by design, as explained in https://github.com/pulumi/pulumi-aws/issues/2131#issuecomment-1242394099 Since we haven't heard back about the other problem - I'll go ahead and close the issue for now.

mikhailshilkov avatar Mar 31 '23 10:03 mikhailshilkov