https://pulumi.com logo
#general
Title
# general
i

incalculable-diamond-5088

08/29/2019, 10:36 PM
Also another question - can I get a region from an aws provider? Or maybe I can create an AWS client from an aws provider, so that I’ll use the AWS SDK with the corresponding configuration
h

high-translator-22614

08/29/2019, 10:38 PM
i did this:
Copy code
def get_region(resource):
    """
    Gets the AWS region for a given resource.
    """
    provider = resource.get_provider('aws::')
    config = pulumi.Config("aws").get('region')
    if provider and provider.region:
        return provider.region
    # These are stolen out of pulumi-aws
    elif config:
        return config
    elif 'AWS_REGION' in os.environ:
        return os.environ['AWS_REGION']
    elif 'AWS_DEFAULT_REGION' in os.environ:
        return os.environ['AWS_DEFAULT_REGION']
    else:
        raise NoRegionError("Unable to determine AWS Region")
i

incalculable-diamond-5088

08/29/2019, 10:53 PM
@high-translator-22614 Thanks! Would still like to have something more streamlined, like
aws.Provider::getAwsConfig()
or alike