Skip to content

wisp-aws-environment

For AWS information from the environment, with easy means for overrides for testing. Currently supports AWS Region and Account ID information.

Also see wisp-deployment-testing for the FakeEnvironmentVariableLoader to use in tests to set Fake environment variables.

Usage

By default, the AWS Region will be read from either “REGION” or “AWS_REGION” environment variables.

val awsRegion: AwsRegion = AwsEnvironment.awsRegion() 

By default, the AWS Account ID will be read from the “ACCOUNT_ID” environment variable.

val awsAccountId: AccountId = AwsEnvironment.awsAccountId()

Using your own custom environment variables

val awsRegion: AwsRegion = AwsEnvironment.awsRegion(environmentVariables = listOf("MY_REGION_ENV_VAR"))
val awsAccountId: AccountId = AwsEnvironment.awsAccountId(environmentVariable = "MY_ACCOUNT_ID_ENV_VAR")

Default fallback for the AWS Region if the environment variable(s) are not set

val awsRegion: AwsRegion = AwsEnvironment.awsRegion(defaultAwsRegion = "us-west-2")