Is there a way to force the output of the `pulumi....
# aws
b
Is there a way to force the output of the
pulumi.Config("aws").require("region")
to confrom to type Region. For example:
Copy code
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:
Copy code
const region: aws.Region = new pulumi.Config("aws").require('region');
b
@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
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
it may not always behave as expected, but if it works that's great. if you see anyweird behaviour, let us know
j
@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
@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
👍 1