0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS SAM 別のスタックからImportValueする

Posted at

別のスタックからImportValueする

Mappingsに環境毎のExport の Name プロパティの値を定義

ただし、ImportValueするものだけにしないと肥大化する

Mappings:
  # ImportValueするものだけにしないと肥大化する
  EnvironmentMap:
    s3:
      VpcId: "s3-base-VpcId"
      SubnetIds: "s3-base-PublicSubnetIds"

!ImportValue !FindInMapはエラーになるので、Fn::ImportValue: !FindInMapとする

  BatchComputeSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      VpcId:
        Fn::ImportValue: !FindInMap [EnvironmentMap, !Ref Stage, VpcId]

その2

  BatchComputeEnvironment:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      ComputeResources:
        Subnets: !Split [ ",", Fn::ImportValue: !FindInMap [EnvironmentMap, !Ref Stage, SubnetIds] ]

Outputsでは、FindInMap使えない

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?