Skip to content
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

Serverless Application Conditional Creation #1079

Open
bbernays opened this issue Mar 25, 2019 · 2 comments
Open

Serverless Application Conditional Creation #1079

bbernays opened this issue Mar 25, 2019 · 2 comments
Labels
area/build sam build command area/intrinsics Ref, If, Sub, GetAtt, ... maintainer/need-followup type/feature Feature request

Comments

@bbernays
Copy link

Description:
It seems that Conditional attribute is not being respected for AWS::Serverless::Application

Steps to reproduce the issue:

  1. Define AWS::Serverless::Application pointing to non-public application in us-east-2
  2. Add conditional statement that evaluates to False
  3. run sam build --region us-west-2

Observed result:
I get the following error:
samcli.commands.validate.lib.exceptions.InvalidSamDocumentException: [InvalidResourceException('<APPLICATION NAME>', 'Application with id arn:aws:serverlessrepo:us-east-2:<ACCOUNT>:applications/<APPLICATION NAME> could not be found.')] ('<APPLICATION NAME>', 'Application with id arn:aws:serverlessrepo:us-east-2:<ACCOUNT>:applications/<APPLICATION NAME> could not be found.')

Expected result:
The expected result would be for the application to be ignored and not built

@sanathkr sanathkr transferred this issue from aws/serverless-application-model Mar 25, 2019
@sriram-mv
Copy link
Contributor

How is your conditional statement defined? Is it based on Intrinsics?

@bbernays
Copy link
Author

Below is resource we are trying to deploy

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Conditions:
  IsProdEnv: !Equals [!Ref "AWS::AccountId", <ACCOUNT-NUMBER-1>]
Resources:
  CouponGeneration:
    Type: AWS::Serverless::Application
    Condition: IsProdEnv
    Properties:
      Location:
        ApplicationId: arn:aws:serverlessrepo:<REGION>:<ACCOUNT-NUMBER-1>:applications/<APPLICATION-NAME>
        SemanticVersion: <VERSION>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build sam build command area/intrinsics Ref, If, Sub, GetAtt, ... maintainer/need-followup type/feature Feature request
Projects
None yet
Development

No branches or pull requests

5 participants