LoginSignup
0
1

More than 1 year has passed since last update.

CloudFormationでImportValueを使うとJSONObjectが見つかったと言われる

Posted at

経緯

セキュリティグループをクロススタックで使いたくてyamlでテンプレートを書いていたものの、Outputsの結果がIDになっているのは確認できているのに

#/SecurityGroups/0: expected type: String, found: JSONObject

とか言われてぐぬぬ…となっていた。
うまくいく方法を見つけた結果からすると、最終的に行き着くのは「一旦フルで書いてみよう」というところ…なのかもしれない。

修正前

  MountTarget1:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId:
        Ref: NfsBatch
      SubnetId:
        Ref: Subnet
      SecurityGroups: 
        - ImportValue: NfsSecurityGroupId

修正後

  MountTarget1:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId:
        Ref: NfsBatch
      SubnetId:
        Ref: Subnet
      SecurityGroups: 
        - Fn::ImportValue: NfsSecurityGroupId

終わりに

関数名ちゃんと全部書こうぜという、かれこれ1時間近く悩んでいたのがバカらしくなるような結果でした。
(ほかにもやりようはあるのかもしれない)
Fn::がついていないImportValueで実行した結果がMappingじゃなくてJSONObjectとして認識されているのがちょっと疑問。

0
1
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
1