This is the new Amazon CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the Amazon CloudFormation User Guide.
AWS::CodeBuild::Project EnvironmentVariable
EnvironmentVariable is a property of the Amazon CodeBuild Project Environment
property type that specifies the name and value of an environment variable for an Amazon CodeBuild
project environment. When you use the environment to run a build, these variables are available for your builds to use. EnvironmentVariable
contains a list of EnvironmentVariable property types.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
Properties
Name-
The name or key of the environment variable.
Required: Yes
Type: String
Minimum:
1Update requires: No interruption
Type-
The type of environment variable. Valid values include:
-
PARAMETER_STORE: An environment variable stored in Systems Manager Parameter Store. For environment variables of this type, specify the name of the parameter as thevalueof the EnvironmentVariable. The parameter value will be substituted for the name at runtime. You can also define Parameter Store environment variables in the buildspec. To learn how to do so, see env/parameter-store in the Amazon CodeBuild User Guide. -
PLAINTEXT: An environment variable in plain text format. This is the default value. -
SECRETS_MANAGER: An environment variable stored in Amazon Secrets Manager. For environment variables of this type, specify the name of the secret as thevalueof the EnvironmentVariable. The secret value will be substituted for the name at runtime. You can also define Amazon Secrets Manager environment variables in the buildspec. To learn how to do so, see env/secrets-manager in the Amazon CodeBuild User Guide.
Required: No
Type: String
Allowed values:
PLAINTEXT | PARAMETER_STORE | SECRETS_MANAGERUpdate requires: No interruption
-
Value-
The value of the environment variable.
Important
We strongly discourage the use of
PLAINTEXTenvironment variables to store sensitive values, especially Amazon secret key IDs.PLAINTEXTenvironment variables can be displayed in plain text using the Amazon CodeBuild console and the Amazon CLI. For sensitive values, we recommend you use an environment variable of typePARAMETER_STOREorSECRETS_MANAGER.Required: Yes
Type: String
Update requires: No interruption
Examples
JSON
{ "Project": { "Environment": { "EnvironmentVariables": [ { "Name": "MY_VAR_1", "Type": "PLAINTEXT", "Value": "VAR_1_VALUE" }, { "Name": "MY_VAR_2", "Type": "PLAINTEXT", "Value": "VAR_2_VALUE" } ] } } }
YAML
Project: Type: AWS::CodeBuild::Project Properties: Environment: EnvironmentVariables: - Name: MY_VAR_1 Type: PLAINTEXT Value: VAR_1_VALUE - Name: MY_VAR_2 Type: PLAINTEXT Value: VAR_2_VALUE