aws / aws/aws-extensions-for-dotnet-cli
Extend template-parameter definition syntax in serverless configuration file
- Dominant language
- C#
- Stars
- 393
- Forks
- 90
- Avg merge
- 2d 19m
- Merged PRs (30d)
- 3
Description
### Describe the feature
Extend supported syntax for defining "template-parameters" in serverless template configuration JSON files to include object and array syntax.
### Use Case
If deploying a serverless template with a lot of parameters, the format "key1=value1;key2=value2;...keyN=valueN" becomes difficult to manage, especially if you are creating multiple configuration to support different environments (ex. Q/A, staging, production).
### Proposed Solution
Update AmazonLambdaTools to check the parameter type for template-parameters.
* [Current] If it's a string, generate a Dictionary using current syntax ("key1=value1;key2=value2;...keyN=valueN")
* [New] If it's an object, process it using property names for keys and cast values as string
* [New] If it's an array of strings, process it using the syntax supported by SAM, which s a list of "key=value" strings
This approach is backward compatible, it won't break usage of existing template files.
**Current Format (string)**
```json
{
"template-parameters": "Secret1ARN=arn:aws:secretsmanager:us-west-1:999888777666:secret:db.mysecret3-AbCdEf;Secret2ARN=arn:aws:secretsmanager:us-west-1:999888777666:secret:mysecret2-GhIkJl;DNSName=leads-aot;AspNetCoreEnvironment=qa;Stage=live;DNSDomain=my-domain.net;HostedZoneId=Z001329499ABC;CertificateArn=arn:aws:acm:us-west-1:999888777666:certificate/111111-aa-2222-cccc-9999999999999;UserPoolId=us-west-1_YzYzYzYzYz;CognitoUserPoolArn=arn:aws:cognito-idp:us-west-1:999888777666:userpool/us-west-1_YzYzYzYzYz;VpcEndpointId=vpce-02e2c2b9db2c3b9f6;LoadBalancerDns=private-my-domain-net-lb-c12345d987654.elb.us-west-1.amazonaws.com;VpcSubnetIds=subnet-111111,subnet-222222;VpcSecurityGroupIds=sg-00011122233334444"
}
````
**New Format (object)**
````json
"template-parameters": {
"Secret1ARN": "arn:aws:secretsmanager:us-west-1:999888777666:secret:db.mysecret3-AbCdEf",
"Secret2ARN": "arn:aws:secretsmanager:us-west-1:999888777666:secret:mysecret2-GhIkJl",
"DNSName": "leads-aot",
"AspNetCoreEnvironment": "qa",
"Stage": "live",
"DNSDomain": "my-domain.net",
"HostedZoneId": "Z001329499ABC",
"CertificateArn": "arn:aws:acm:us-west-1:999888777666:certificate/111111-aa-2222-cccc-9999999999999",
"UserPoolId": "us-west-1_YzYzYzYzYz",
"CognitoUserPoolArn": "arn:aws:cognito-idp:us-west-1:999888777666:userpool/us-west-1_YzYzYzYzYz",
"VpcEndpointId": "vpce-02e2c2b9db2c3b9f6",
"LoadBalancerDns": "private-my-domain-net-lb-c12345d987654.elb.us-west-1.amazonaws.com",
"VpcSubnetIds": "subnet-111111,subnet-222222",
"VpcSecurityGroupIds": "sg-00011122233334444"
},
````
**New Format (array - SAM compatible)**
````json
{
"template-parameters": [
"Secret1ARN=arn:aws:secretsmanager:us-west-1:999888777666:secret:db.mysecret3-AbCdEf",
"Secret2ARN=arn:aws:secretsmanager:us-west-1:999888777666:secret:mysecret2-GhIkJl",
"DNSName=leads-aot",
"AspNetCoreEnvironment=qa",
"Stage=live",
"DNSDomain=my-domain.net",
"HostedZoneId=Z001329499ABC",
"CertificateArn=arn:aws:acm:us-west-1:999888777666:certificate/111111-aa-2222-cccc-9999999999999",
"UserPoolId=us-west-1_YzYzYzYzYz",
"CognitoUserPoolArn=arn:aws:cognito-idp:us-west-1:999888777666:userpool/us-west-1_YzYzYzYzYz",
"VpcEndpointId=vpce-02e2c2b9db2c3b9f6",
"LoadBalancerDns=private-my-domain-net-lb-c12345d987654.elb.us-west-1.amazonaws.com",
"VpcSubnetIds=subnet-111111,subnet-222222",
"VpcSecurityGroupIds=sg-00011122233334444"
]
}
````
### Other Information
I'll be submitting a PR implementing this change
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### Targeted .NET platform
(All)
### CLI extension version
_No response_
### Environment details (OS name and version, etc.)
Any
Contributor guide
Research direction
The issue names AmazonLambdaTools but no implementation file or test. Locate the existing template-parameters handling and its string parsing, then trace how configuration values reach deployment. Done means preserving the string syntax while also accepting object values and SAM-compatible arrays, with coverage for each form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp
- Domain
- cli, cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100