我为我的堆栈创建了代码行,在提交特定分支时,应该会触发更新堆栈,一切正常,但问题出在参数上,特别是秘密参数。这是我的问题: 1.我如何在ParameterOverrides中省略“丑陋的”JSON字符串,现在,没有问题,但如果我将覆盖30个以上的参数,它将是一个长字符串,我可以包含带有参数的JSON文件吗?如果是,我该怎么做?
"ResRootStackCodePipeline": {
"Type": "AWS::CodePipeline::Pipeline",
"DependsOn": [
"ResRootStackServerI"
],
"Properties": {
"Name": "AutoProjectCodePipeline",
"RestartExecutionOnUpdate": "true",
"RoleArn": {
"Fn::Join": [
"",
[
"arn:aws:iam::",
{
"Ref": "AWS::AccountId"
},
":role/service-role/AWSCodePipelineServiceRole"
]
]
},
"ArtifactStore": {
"Type": "S3",
"Location": "bucket-codepipeline-test"
},
"Stages": [
{
"Name": "APSource",
"Actions": [
{
"Name": "APSourceProcess",
"ActionTypeId": {
"Category": "Source",
"Owner": "ThirdParty",
"Provider": "GitHub",
"Version": "1"
},
"RunOrder": 1,
"Configuration": {
"Branch": "instances-test",
"OAuthToken": "xxx",
"Owner": "muume",
"PollForSourceChanges": "true",
"Repo": "autoproject-aws-infra"
},
"OutputArtifacts": [
{
"Name": "APGithubArtifact"
}
]
}
]
},
{
"Name": "APDeploy",
"Actions": [
{
"Name": "APUpdateProcess",
"ActionTypeId": {
"Category": "Deploy",
"Owner": "AWS",
"Provider": "CloudFormation",
"Version": "1"
},
"RunOrder": 1,
"Configuration": {
"ActionMode": "CREATE_UPDATE",
"RoleArn": {
"Fn::Join": [
"",
[
"arn:aws:iam::",
{
"Ref": "AWS::AccountId"
},
":role/CloudFormationRole"
]
]
},
"StackName": {
"Ref": "AWS::StackName"
},
"ParameterOverrides": { "Fn::Join": [ "", [
"{\"ParaNamePrefix\": \"tescik\",\"ParaTemplateURI\": \"https://localhost.xx/\",\"ParaServerInstanceTypeFront\": \"t2.medium\"}"
]]},
"TemplatePath": "APGithubArtifact::instances-test/Stack_Root_I.json",
"TemplateConfiguration": "APGithubArtifact::instances-test/simple_configuration.json"
},
"OutputArtifacts": [],
"InputArtifacts": [
{
"Name": "APGithubArtifact"
}
]
}
]
}
]
}
}
也许你看到了解决这个问题的其他解决方案?
发布于 2020-04-22 22:40:27
使用YAML。对于CloudFormation来说,它比JSON要好得多。下面是一个参数重写的示例:
ParameterOverrides: |-
{
"SomeParameterOverride": "xxx",
"SomeOtherParameterOverride":"yyy"
}
您可以使用Cloudformation designer或类似如下的站点轻松地将现有的JSON转换为YAML:https://www.json2yaml.com/
YAML还允许对模板中的其他资源和参数进行注释和轻松引用。
发布于 2020-01-27 22:44:37
https://stackoverflow.com/questions/59930697
复制相似问题