BuildEnvironmentVariable
- class aws_cdk.aws_codebuild.BuildEnvironmentVariable(*, value, type=None)
Bases:
object
- Parameters:
value (
Any
) – The value of the environment variable. For plain-text variables (the default), this is the literal value of variable. For SSM parameter variables, pass the name of the parameter here (parameterName
property ofIParameter
). For SecretsManager variables secrets, pass either the secret name (secretName
property ofISecret
) or the secret ARN (secretArn
property ofISecret
) here, along with optional SecretsManager qualifiers separated by ‘:’, like the JSON key, or the version or stage (see https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.env.secrets-manager for details).type (
Optional
[BuildEnvironmentVariableType
]) – The type of environment variable. Default: PlainText
- ExampleMetadata:
infused
Example:
# later: # project: codebuild.PipelineProject source_output = codepipeline.Artifact() build_action = codepipeline_actions.CodeBuildAction( action_name="Build1", input=source_output, project=codebuild.PipelineProject(self, "Project", build_spec=codebuild.BuildSpec.from_object({ "version": "0.2", "env": { "exported-variables": ["MY_VAR" ] }, "phases": { "build": { "commands": "export MY_VAR="some value"" } } }) ), variables_namespace="MyNamespace" ) codepipeline_actions.CodeBuildAction( action_name="CodeBuild", project=project, input=source_output, environment_variables={ "MyVar": codebuild.BuildEnvironmentVariable( value=build_action.variable("MY_VAR") ) } )
Attributes
- type
The type of environment variable.
- Default:
PlainText
- value
The value of the environment variable.
For plain-text variables (the default), this is the literal value of variable. For SSM parameter variables, pass the name of the parameter here (
parameterName
property ofIParameter
). For SecretsManager variables secrets, pass either the secret name (secretName
property ofISecret
) or the secret ARN (secretArn
property ofISecret
) here, along with optional SecretsManager qualifiers separated by ‘:’, like the JSON key, or the version or stage (see https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.env.secrets-manager for details).