I've created a new WebApplication using Codestar on AWS and generally it's working pretty well. The big problem I've got right now, is that the environment variables which I set inside Beanstalk's software configuration don't persist between deployments.
I very quickly found that I can use SourceConfiguration
inside template.yml
to achieve this, so here is what I did:
- Deployed my app
- Once ready, I defined all my variables in software configuration and waited for the app to re-deploy
- Went to
Actions
->Save Configuration
, and saved everything successfully - In my template.yml, I put the name of the new configuration and deployed the app again
The above process worked the first time I did it.
However when I make changes to the configuration, save them again under a new name, and redeploy the app with new SourceConfiguration it doesn't use the latest configuration I created and goes back to the previous one.
If I manually load the saved config after deployment, it successfully restores the env I set.
Am I missing something very obvious?
Here is my redacted template.yml in case I'm doing something wrong.
AWSTemplateFormatVersion: 2010-09-09
Transform:
- AWS::CodeStar
Resources:
EBConfigurationTemplate:
Description: The AWS Elastic Beanstalk configuration template to be created for this project, which defines configuration settings used to deploy different versions of an application.
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
ApplicationName: !Ref 'EBApplication'
Description: The name of the sample configuration template.
OptionSettings:
- Namespace: aws:elasticbeanstalk:environment
OptionName: EnvironmentType
Value: LoadBalanced
- Namespace: aws:elasticbeanstalk:environment
OptionName: ServiceRole
Value: !Ref 'EBTrustRole'
- Namespace: aws:elasticbeanstalk:healthreporting:system
OptionName: SystemType
Value: enhanced
SolutionStackName: !Ref 'SolutionStackName'
SourceConfiguration:
ApplicationName: !Ref 'EBApplication'
TemplateName: "my-saved-vars" <---- This is where i define my old configuration