Skip to content

Conversation

@rtkjbeverly
Copy link
Contributor

@rtkjbeverly rtkjbeverly commented Nov 19, 2025

Issue #: #711

Description of changes:

Support sourcing parameters and tags for rain deploy using prefixed environment variable names.

This change adds support within the rain deploy command for sourcing values from environment variables. Parameters will be sourced using any variable with a prefix of RAIN_VAR_ and RAIN_DEFAULT_TAG_* for tags.

# Set CloudFormation parameters 'VpcId' and 'Environment'
export RAIN_VAR_VpcId=vpc-xxxxxxx
export RAIN_VAR_Environment=perftest

# Set CloudFormation tags 'Environment' and 'Owner'
export RAIN_DEFAULT_TAG_Owner=$USER

# file: template.yaml
# Parameters:
#   InstanceType:
#     Type: String
#     Description: EC2 instance type
#     Default: t3.micro
#   Environment:
#     Type: String
#     Default: dev
#   VpcId:
#     Type: String

# Deploy with Rain (environment variables are automatically picked up)
rain deploy my-stack template.yaml

Testing
Confirmed with the addition of new unit tests that all tests are passed.

Exploratory tests performed on the branch are:

  • No environment variables for standard deployment flow. Confirmed no tags or parameters passed.
  • The setting of tags using environment variables. Confirmed tags applied, no parameters passed.
  • The setting of tags and parameters using environment variables. Confirmed tags and only applicable parameters impacted.

Additional Notes

  • For environment naming, I went with RAIN_ as prefix for the tool, then VAR and DEFAULT_TAG as that was what the internal wrapper scripts this feature is based on used. You can see Support rain deploy sourcing parameters & tags from environment variables #711 for a simplified example of this script. DEFAULT_TAG could be renamed to STACK_TAG or something else to better reflect its the tags of the stack, and not modifying the template in anyway.
  • Some of the logs use config.Debugf while others use fmt.Print, I just tried to copy whatever kind of worked, but if we should shift them to standard logging, that works.

@rtkjbeverly rtkjbeverly marked this pull request as ready for review November 19, 2025 21:25
@atennak1
Copy link
Contributor

Going to start looking at this. Thank you @rtkjbeverly for submitting!

@atennak1 atennak1 merged commit 3410695 into aws-cloudformation:main Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants