Comments (5)
Hi @yan-olydis, thanks for reporting the issue. Could you share your template file? SAM CLI does not cover resolving all the intrinsic functions and from the traceback, this might be throwing an error because of that.
from aws-sam-cli.
this is my template
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
General parameters
EnvType:
Description: Environment Type
Type: String
AllowedValues:
- development
- staging
- production
DBInstanceClass:
Description: Instance class
Type: String
isEnableDeletionProtection:
Description: Enable Deletion Protection
Type: String
Default: false
AllowedValues:
- true
- false
isEnableBackup:
Description: Enable DocumentDB Backup
Type: String
Default: false
AllowedValues:
- true
- false
Conditions:
isProduction: !Equals [ !Ref EnvType, "production" ]
isDev: !Equals [ !Ref EnvType, "development" ]
Mappings:
Network:
development:
NbAzs: 3
CidrBlockPrefix: 10.1
CidrBlock: 10.1.0.0/16
staging:
NbAzs: 3
CidrBlockPrefix: 10.2
CidrBlock: 10.2.0.0/16
production:
NbAzs: 3
CidrBlockPrefix: 10.3
CidrBlock: 10.3.0.0/16
Resources:
Network:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-vpc
TemplateURL: 'network/vpc.yml'
Parameters:
EnvType: !Ref EnvType
RegionAzs: !FindInMap [Network, !Ref EnvType, NbAzs]
CidrBlockPrefix: !FindInMap [Network, !Ref EnvType, CidrBlockPrefix]
EcsCluster:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-ecs
TemplateURL: 'ecs/ecs.yml'
Parameters:
EnvType: !Ref EnvType
VpcId: !GetAtt Network.Outputs.VpcId
CidrBlockPrefix: !FindInMap [Network, !Ref EnvType, CidrBlockPrefix]
LoadBalancing:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-nlb
TemplateURL: 'nlb/nlb.yml'
Parameters:
VpcId: !GetAtt Network.Outputs.VpcId
PrivateSubnets: !GetAtt Network.Outputs.PrivateSubnets
PrivateHostedZoneId: !GetAtt Network.Outputs.PrivateHostedZoneId
DocumentDB:
Type: AWS::CloudFormation::Stack
DependsOn:
- Encryption
Properties:
StackName: my-database
TemplateURL: 'db/db.yml'
Parameters:
EnvType: !Ref EnvType
PrivateSubnets: !GetAtt Network.Outputs.PrivateSubnets
AvailabilityZones: !GetAtt Network.Outputs.AvailabilityZones
EncryptionKeyId: !GetAtt Encryption.Outputs.EncryptionKeyId
DBInstanceClass: !Ref DBInstanceClass
isEnableDeletionProtection: !Ref isEnableDeletionProtection
isEnableBackup: !Ref isEnableBackup
VpcId: !GetAtt Network.Outputs.VpcId
Encryption:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-encryption-key
TemplateURL: encryption/encryption.yml
Parameters:
EnvType: !Ref EnvType
from aws-sam-cli.
Thanks for providing the template file. I tried running sam build
on the below template, but the command succeeds for me. I don't see any lambda/serverless functions in the template you provided as well. Would you be able to provide the nested stack templates? My guess is there is some intrinsic function in that template which SAM CLI does not support.
template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
sam-app-6787
Sample SAM Template for sam-app-6787
Parameters:
EnvType:
Description: Environment Type
Type: String
AllowedValues:
- development
- staging
- production
DBInstanceClass:
Description: Instance class
Type: String
isEnableDeletionProtection:
Description: Enable Deletion Protection
Type: String
Default: false
AllowedValues:
- true
- false
isEnableBackup:
Description: Enable DocumentDB Backup
Type: String
Default: false
AllowedValues:
- true
- false
Conditions:
isProduction: !Equals [ !Ref EnvType, "production" ]
isDev: !Equals [ !Ref EnvType, "development" ]
Mappings:
Network:
development:
NbAzs: 3
CidrBlockPrefix: 10.1
CidrBlock: 10.1.0.0/16
staging:
NbAzs: 3
CidrBlockPrefix: 10.2
CidrBlock: 10.2.0.0/16
production:
NbAzs: 3
CidrBlockPrefix: 10.3
CidrBlock: 10.3.0.0/16
Resources:
Network:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-vpc
TemplateURL: 'nested-template.yaml'
Parameters:
EnvType: !Ref EnvType
RegionAzs: !FindInMap [Network, !Ref EnvType, NbAzs]
CidrBlockPrefix: !FindInMap [Network, !Ref EnvType, CidrBlockPrefix]
EcsCluster:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-ecs
TemplateURL: 'nested-template.yaml'
Parameters:
EnvType: !Ref EnvType
VpcId: !GetAtt Network.Outputs.VpcId
CidrBlockPrefix: !FindInMap [Network, !Ref EnvType, CidrBlockPrefix]
LoadBalancing:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-nlb
TemplateURL: 'nested-template.yaml'
Parameters:
VpcId: !GetAtt Network.Outputs.VpcId
PrivateSubnets: !GetAtt Network.Outputs.PrivateSubnets
PrivateHostedZoneId: !GetAtt Network.Outputs.PrivateHostedZoneId
DocumentDB:
Type: AWS::CloudFormation::Stack
DependsOn:
- Encryption
Properties:
StackName: my-database
TemplateURL: 'nested-template.yaml'
Parameters:
EnvType: !Ref EnvType
PrivateSubnets: !GetAtt Network.Outputs.PrivateSubnets
AvailabilityZones: !GetAtt Network.Outputs.AvailabilityZones
EncryptionKeyId: !GetAtt Encryption.Outputs.EncryptionKeyId
DBInstanceClass: !Ref DBInstanceClass
isEnableDeletionProtection: !Ref isEnableDeletionProtection
isEnableBackup: !Ref isEnableBackup
VpcId: !GetAtt Network.Outputs.VpcId
Encryption:
Type: AWS::CloudFormation::Stack
Properties:
StackName: my-encryption-key
TemplateURL: 'nested-template.yaml'
Parameters:
EnvType: !Ref EnvType
from aws-sam-cli.
Closing due to inactivity.
from aws-sam-cli.
⚠️ COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
from aws-sam-cli.
Related Issues (20)
- Bug: sam validate fails for template using 1.122.0 or 1.223.0 HOT 4
- Feature request: Prune Old Versions HOT 2
- Bug: `sam build` Ignores Files in dist/ Directory When Specified in .gitignore HOT 2
- Bug: DBProxyTargetGroup Creation is very slow when using SAM deploy HOT 3
- Bug: sam build - JSONDecodeError HOT 1
- Bug: `sam init` error: "could not clone repo" (non-zero exit status 128) HOT 10
- Bug: parsing Ref in template.json is incorrect HOT 3
- Bug: sam validate - UnexpectedRuleException HOT 5
- Bug: Numpy In Lambda Layer HOT 3
- Bug: sam pipeline bootstrap --oidc-provider gitlab with a custom gitlab url creates an identity provider with excessive `/` suffix HOT 4
- Bug: Serverless Api: Incorrect handling of !If statement HOT 3
- Feature request: Resolve AWS::Include transform intrinsic for DefinitionBody in validate HOT 2
- Bug: sam local invoke - InvalidParameterValueException HOT 1
- Bug: sam build can't check the JVM version on gradle >= v8.9 HOT 2
- Bug: Sam build hanging in github-actions HOT 3
- Feature request: Add `dotnet` BuildMethod in addition to `dotnet7` HOT 3
- Binary execution issues in SAM CLI container due to read-only file system HOT 3
- Bug: sam deploy started failing HOT 2
- --debug-port not working in SAM Local Invoke on Windows HOT 3
- SAM Build Not Mounting Lambda Code in `/var/task` During `sam local start api` on Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sam-cli.