https://pulumi.com logo
Title
b

busy-lion-51883

03/04/2022, 8:07 PM
s

steep-toddler-94095

03/06/2022, 6:27 PM
Pulumi exports it as a type
import { Region } from "@pulumi/aws";
const region = new pulumi.Config("aws").require('region') as Region
You will run into runtime errors if the region in the config isn't actually a valid region, but this will pass compile checks
:thank-you: 1
b

busy-lion-51883

03/07/2022, 2:34 PM
Is there a difference/preference between using ‘as’ and specifying the type on the variable? eg:
const region: aws.Region = new pulumi.Config("aws").require('region')
s

steep-toddler-94095

03/08/2022, 3:48 AM
in this specific case, no. both will work fine. though i think what you have above is preferred in most cases
:thank-you: 1