gpt4 book ai didi

amazon-web-services - 我在云形成方面遇到问题。将 Fn::Join 与参数一起使用时出错

转载 作者:行者123 更新时间:2023-12-03 07:21:08 25 4
gpt4 key购买 nike

我正在尝试创建一个安全组并使用 cloudformation 从参数调用其他安全组。我使用它作为资源,但是我从 cloudfromation 收到以下错误消息

Template validation error: Template error: every Fn::Join object requires two parameters, (1) a string delimiter and (2) a list of strings to be joined or a function that returns a list of strings (such as Fn::GetAZs) to be joined.

AWSTemplateFormatVersion : 2010-09-09
Description: "simple web layer"
Parameters:
Securitygroupid:
Description: enter sc
Type: List<AWS::EC2::SecurityGroup::Id>
NoEcho: false
Default: sg-05323df39f12d8034

Resources:
Lpsecurity:
Type: AWS::EC2::SecurityGroup
Properties:
Securitygroupid:
Description: enter sc
Type: List<AWS::EC2::SecurityGroup::Id
NoEcho: false
Default: sg-05323df39f12d8034
VpcId: !Ref Vpc
GroupDescription: Sample target security group
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: !Ref Securitycab
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: !Ref Securitycab
MyEC2Instance1:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: !Ref ImageId
InstanceType: t2.micro
SubnetId: !Select [ 0, !Ref Subnets ]
SecurityGroupIds: !Join [ ",", [ !Ref Securitygroupid, !Ref Lpsecurity ]]

我在这里做错了什么?

最佳答案

我找到了解决方案。

SecurityGroupIds:  !Split
- ","
- !Sub
- "${idList},${Lpsecurity}"
- idList: !Join [",",!Ref "SecurityGroup"]

关于amazon-web-services - 我在云形成方面遇到问题。将 Fn::Join 与参数一起使用时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60135836/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com