Amazon web services FindInMap内的云形成变换
我正在尝试转换传递给FindInMap的一个键。我试图遵循的示例如下所示: 我收到以下错误消息作为响应:Amazon web services FindInMap内的云形成变换,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我正在尝试转换传递给FindInMap的一个键。我试图遵循的示例如下所示: 我收到以下错误消息作为响应: mapping values are not allowed here in "<unicode string>", line 186, column 28: - 'Fn::Transform': ^ (line: 186) 此处不允许使用映射值 在“”第186行
mapping values are not allowed here
in "<unicode string>", line 186, column 28:
- 'Fn::Transform':
^ (line: 186)
此处不允许使用映射值
在“”第186行第28列中:
-“Fn::Transform”:
^(第186行)
我的语法有问题吗?还是通常不可能执行此操作?这是一个语法错误。给出了
Replace
操作的一个示例。这是一个我能够部署的模板,它在FindInMap
中使用Transform
,并创建一个带有testkey:testvalue
标记的S3 bucket:
Parameters:
Env:
Type: String
Default: env-dev
Mappings:
envdev:
us-east-1:
AppSubnetIds: test-value
Resources:
S3Bucket:
Type: "AWS::S3::Bucket"
Properties:
Tags:
- Key: test-key
Value:
'Fn::FindInMap':
- 'Fn::Transform':
Name: 'String'
Parameters:
InputString: !Ref Env
Operation: Replace
Old: "-"
New: ""
- !Ref "AWS::Region"
- AppSubnetIds
Parameters:
Env:
Type: String
Default: env-dev
Mappings:
envdev:
us-east-1:
AppSubnetIds: test-value
Resources:
S3Bucket:
Type: "AWS::S3::Bucket"
Properties:
Tags:
- Key: test-key
Value:
'Fn::FindInMap':
- 'Fn::Transform':
Name: 'String'
Parameters:
InputString: !Ref Env
Operation: Replace
Old: "-"
New: ""
- !Ref "AWS::Region"
- AppSubnetIds