Reputation: 101
I have two stacks, the VPC deployment stack and my app deployment stack. In VPC stack, I am exporting value called as EnvType which can be a dev, prod or staging. As per this exported value, I want to deploy one resource in app deployment stack. If EnvType = dev, then don't deploy it. Otherwise, deploy it. How I can achieve this?
Upvotes: 1
Views: 1246
Reputation: 238497
I don't think you can do this, as ImportValue
can't be used in conditions.
You can easily verify that using the two sample templates:
bucket1.yaml (exports EnvType
)
---
Resources:
MyBucket:
Type: AWS::S3::Bucket
Outputs:
EnvType:
Value: "prod"
Export:
Name: EnvType
bucket2.yaml (imports EnvType
and tries to use it in IsProd
condition)
---
Conditions:
IsProd:
!Equals [!ImportValue EnvType, 'prod']
Resources:
MyBucket2:
Condition: IsProd
Type: AWS::S3::Bucket
Upvotes: 2