执行 AWS cli 命令如下:
aws codepipeline get-pipeline --name pipeline_name
产生以下输出
{
"pipeline": {
"name": "xxxxx",,
"roleArn": "xxxxx",,
"artifactStore": {
"type": "S3",
"location": "xxxxx",
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "CodeCommit",
"version": "1"
},
"runOrder": 1,
"configuration": {
"BranchName": "main",
"PollForSourceChanges": "true",
"RepositoryName": "xxxxx",
},
"outputArtifacts": [
{
"name": "SourceOutput"
}
],
"inputArtifacts": []
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "xxxxx",
},
"outputArtifacts": [
{
"name": "BuildOutput"
}
],
"inputArtifacts": [
{
"name": "SourceOutput"
}
]
}
]
},
{
"name": "Deploy",
"actions": [
{
"name": "Deploy",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"provider": "CodeDeployToECS",
"version": "1"
},
"runOrder": 1,
"configuration": {
"AppSpecTemplateArtifact": "BuildOutput",
"AppSpecTemplatePath": "appspec.yml",
"ApplicationName": "xxxxx",
"DeploymentGroupName": "xxxxx",
"Image1ArtifactName": "BuildOutput",
"Image1ContainerName": "IMAGE1_NAME",
"TaskDefinitionTemplateArtifact": "BuildOutput",
"TaskDefinitionTemplatePath": "taskdef.json"
},
"outputArtifacts": [],
"inputArtifacts": [
{
"name": "BuildOutput"
}
]
}
]
}
],
"version": 3
},
"metadata": {
"pipelineArn": "xxxxx",
"created": "xxxxx",
"updated": "xxxxx",
}
}
我们可以看到 metadata 字段有 "pipelineArn": "xxxxx",
. 但是这个 arn 在控制台中不可用,我也找不到任何 Terraform 数据源。
是否可以在 Terraform 中检索 codepipline ARN?
另外,为了澄清我在需要"aws_codestarnotifications_notification_rule"
资源 arn 的地方需要这个。