Thread
#aws
    b

    busy-lion-51883

    6 months ago
    Is there a way to force the output of the
    pulumi.Config("aws").require("region")
    to confrom to type Region. For example:
    const region = new pulumi.Config("aws").require('region');
    
    const codepipelinesProvider = new aws.Provider("codepipelinesProvider", {
      profile: CODEPIPELINES_PROFILE_ID,
      region: region,
    });
    in this case I get a type mismatch error:
    Type string is not assignable to Type Input
    would the following be adviseable:
    const region: aws.Region = new pulumi.Config("aws").require('region');
    b

    billowy-army-68599

    6 months ago
    @busy-lion-51883 you'd need to use an
    apply
    for this, as the config is retrieved async
    also, the config setting is global, so unless you need an explicit provider you probably don't actually need to do this
    b

    busy-lion-51883

    6 months ago
    it appears to work without using apply. Is the recommendation to use apply in order to get it functional or to avoid some sort of undesirable side effect?
    b

    billowy-army-68599

    6 months ago
    it may not always behave as expected, but if it works that's great. if you see anyweird behaviour, let us know
    j

    jolly-alligator-19698

    6 months ago
    @billowy-army-68599 https://www.pulumi.com/docs/intro/concepts/config/ doesn't have any examples using
    apply
    , they're all using plain
    require*()
    or
    get*()
    . Is the need for
    apply
    an omission in that documentation?
    b

    billowy-army-68599

    6 months ago
    @jolly-alligator-19698 the examples show you how to retrieve a configuration item from the config stack. the values as retrieved as
    Input<T>
    and usually, you'd pass those values to another resource which take an
    Input<T>
    However, if you need to pass a value to a resource which is a string, you'd need to use an
    apply
    It looks like the region can be tInputty typein this case, so an apply is not needed, I should have checked before commenting