Skip to content

Include an optional SAM config file when deploying #946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

stephen-cox-nzx
Copy link

What does this PR do?

This PR:

  • adds an additional optional 7th argument (EXPORTER_SAMCONFIG_FILE) to the publish_lambda.sh script
    • this allows users of the script to specify a SAM config file to implement AWS tags
      example samconfig.yaml
version: 0.1
default:
  global:
    parameters:
      tags: applicationcode=elastic-serverless-forwarder businessunitcode=itops costcentre=example_cc componentcode=sam githubrepo=MyOrg/MyRepo environmentcode=dev githubbranch=main releaseversion=v1.20.1 releaseinstance=1 releasestatus=live deploydate=2025-08-06 destroyafter=N/A
  deploy:
    parameters:
      confirm_changeset: false

Why is it important?

Deploying Elastic Serverless forwarder into a corporate environment requires compliance with corporate tagging standards. This change allows an easy way for users of this script to include tags into the created artifacts.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md and updated share/version.py, if my change requires a new release.

Author's Checklist

  • review the form and execution of the publish_lambda.sh

How to test this PR locally

  • Create a samconfig.yaml / toml with tags specified
  • Execute the publish_lambda.sh specifying the full path to the config file as the seventh (7th) argument to the publish_lambda.sh script
  • validate that the tags are created on the AWS artifacts

Related issues

Use cases

Deploying the serverless forwarder via the Direct approach, but automatically tagging the AWS resources it creates

Logs

(partial - as returned from by GitHub Action Workflow)

sam deploy --template-file /tmp/publish.bWocrZuR5Z/.aws-sam/build/publish/packaged.yaml --stack-name <YOUR STACK NAME>
	Deploying with following values
	===============================
	Stack name                   : ITOps-Elastic-Serverless-Forwarder
	Region                       : REDACTED
	Confirm changeset            : False
	Disable rollback             : False
	Deployment s3 bucket         : elastic-serverless-forwarder-REDACTED
	Capabilities                 : ["CAPABILITY_NAMED_IAM"]
	Signing Profiles             : {}
Initiating deployment
=====================
	Uploading to ITOps-Elastic-Serverless-Forwarder//REDACTED.template  6181 / 6181  (100.00%)
Waiting for changeset to be created..
CloudFormation stack changeset
-------------------------------------------------------------------------------------------------
Operation                LogicalResourceId        ResourceType             Replacement            
-------------------------------------------------------------------------------------------------
* Modify                 ApplicationElasticServ   AWS::Lambda::Permissio   False                  
                         erlessForwarderCloudWa   n                                               
                         tchLogsEventREDACTED                                                   
                         Permission                                                               
* Modify                 ApplicationElasticServ   AWS::Logs::Subscriptio   False                  
                         erlessForwarderCloudWa   nFilter                                         
                         tchLogsEventREDACTED                                                   
* Modify                 ApplicationElasticServ   AWS::IAM::Role           False                  
                         erlessForwarderCustomR                                                   
                         ole                                                                      
* Modify                 ApplicationElasticServ   AWS::Lambda::EventSour   Conditional            
                         erlessForwarderSQSCont   ceMapping                                       
                         inuingEvent                                                              
* Modify                 ApplicationElasticServ   AWS::Lambda::Function    False                  
                         erlessForwarder                                                          
* Modify                 ElasticServerlessForwa   AWS::SQS::Queue          False                  
                         rderContinuingDLQ                                                        
* Modify                 ElasticServerlessForwa   AWS::SQS::Queue          False                  
                         rderContinuingQueue                                                      
* Modify                 ElasticServerlessForwa   AWS::IAM::Policy         False                  
                         rderPolicy                                                               
* Modify                 ElasticServerlessForwa   AWS::SQS::Queue          False                  
                         rderReplayDLQ                                                            
* Modify                 ElasticServerlessForwa   AWS::SQS::Queue          False                  
                         rderReplayQueue                                                          
-------------------------------------------------------------------------------------------------
Changeset created successfully. arn:aws:cloudformation:ap-southeast-2:REDACTED:changeSet/samcli-deployREDACTED/REDACTED
2025-08-11 22:43:41 - Waiting for stack create/update to complete
CloudFormation events from stack operations (refresh every 5.0 seconds)
-------------------------------------------------------------------------------------------------
ResourceStatus           ResourceType             LogicalResourceId        ResourceStatusReason   
-------------------------------------------------------------------------------------------------
UPDATE_IN_PROGRESS       AWS::CloudFormation::S   ITOps-Elastic-           User Initiated         
                         tack                     Serverless-Forwarder                            
UPDATE_IN_PROGRESS       AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderContinuingDLQ                               
UPDATE_IN_PROGRESS       AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderReplayDLQ                                   
UPDATE_IN_PROGRESS       AWS::IAM::Role           ApplicationElasticServ   -                      
                                                  erlessForwarderCustomR                          
                                                  ole                                             
UPDATE_COMPLETE          AWS::IAM::Role           ApplicationElasticServ   -                      
                                                  erlessForwarderCustomR                          
                                                  ole                                             
UPDATE_COMPLETE          AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderReplayDLQ                                   
UPDATE_COMPLETE          AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderContinuingDLQ                               
UPDATE_IN_PROGRESS       AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderReplayQueue                                 
UPDATE_IN_PROGRESS       AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderContinuingQueue                             
UPDATE_COMPLETE          AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderReplayQueue                                 
UPDATE_COMPLETE          AWS::SQS::Queue          ElasticServerlessForwa   -                      
                                                  rderContinuingQueue                             
UPDATE_IN_PROGRESS       AWS::Lambda::Function    ApplicationElasticServ   -                      
                                                  erlessForwarder                                 
UPDATE_COMPLETE          AWS::Lambda::Function    ApplicationElasticServ   -                      
                                                  erlessForwarder                                 
UPDATE_IN_PROGRESS       AWS::Lambda::EventSour   ApplicationElasticServ   -                      
                         ceMapping                erlessForwarderSQSCont                          
                                                  inuingEvent                                     
UPDATE_COMPLETE          AWS::Lambda::EventSour   ApplicationElasticServ   -                      
                         ceMapping                erlessForwarderSQSCont                          
                                                  inuingEvent                                     
UPDATE_COMPLETE_CLEANU   AWS::CloudFormation::S   ITOps-Elastic-           -                      
P_IN_PROGRESS            tack                     Serverless-Forwarder                            
UPDATE_COMPLETE          AWS::CloudFormation::S   ITOps-Elastic-           -                      
                         tack                     Serverless-Forwarder                            
-------------------------------------------------------------------------------------------------
Successfully created/updated stack - ITOps-Elastic-Serverless-Forwarder in REDACTED

Copy link

cla-checker-service bot commented Aug 11, 2025

💚 CLA has been signed

Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link

🔍 Preview links for changed docs

@stephen-cox-nzx
Copy link
Author

Contributor Agreement: has now been signed

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.

Support tag creation on Serverless Forwarder resources (Function, Queues etc)
1 participant