'Codepipeline ARN not available through Terraform but available in metadata using cli

Executing AWS cli command as below:

aws codepipeline get-pipeline --name pipeline_name

produces following output

{
    "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",
    }
}

We can see that metadata field has "pipelineArn": "xxxxx", . But this arn is not available in console nor have I been able to find any Terraform data source for this.

Is it possible to retrieve codepipline ARN in Terraform?

Also, to clarify I need this for "aws_codestarnotifications_notification_rule" where resource arn is required.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source