sparse-intern-71089
08/03/2021, 11:37 AMcool-fireman-90027
08/03/2021, 12:49 PM"""An AWS Python Pulumi program"""
import pulumi
import pulumi_aws as aws
# Create an AWS resource (S3 Bucket)
awsConfig = pulumi.Config("aws")
awsRegion = awsConfig.get("region")
if awsRegion != "us-east-2":
raise ValueError("provider has bad region")
pulumi.export("aws_region_selected", awsRegion)
Here are the aws provider inputs
You can test it out by changing the region to and then it will throw the error:
pulumi config set aws:region us-east-1
If you set it back to
pulumi config set aws:region us-east-2
- no error will be thrown.great-sunset-355
08/03/2021, 1:39 PMred-match-15116
08/03/2021, 3:18 PMdef validate_region(region):
if region != "wanted region":
raise ValueError("provider has bad region")
provider.region.apply(validate_region)
red-match-15116
08/03/2021, 3:20 PMgreat-sunset-355
08/03/2021, 5:02 PMred-match-15116
08/03/2021, 5:08 PMOutput
is only available within an apply. That is the pulumi programming model.
Re: disabling default providers is tracked in this issue - feel free to upvote or comment with your input.great-sunset-355
08/03/2021, 5:39 PMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by