Skip to content

Resource: awsCodestarconnectionsConnection

Provides a CodeStar Connection.

\~> NOTE: The awsCodestarconnectionsConnection resource is created in the state pending. Authentication with the connection provider must be completed in the AWS Console.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCodestarconnectionsConnectionExample =
  new aws.codestarconnectionsConnection.CodestarconnectionsConnection(
    this,
    "example",
    {
      name: "example-connection",
      providerType: "Bitbucket",
    }
  );
const awsCodepipelineExample = new aws.codepipeline.Codepipeline(
  this,
  "example_1",
  {
    artifactStore: [{}],
    name: "tf-test-pipeline",
    roleArn: "${aws_iam_role.codepipeline_role.arn}",
    stage: [
      {
        action: [
          {
            category: "Source",
            configuration: [
              {
                branchName: "main",
                connectionArn: awsCodestarconnectionsConnectionExample.arn,
                fullRepositoryId: "my-organization/test",
              },
            ],
            name: "Source",
            outputArtifacts: ["source_output"],
            owner: "AWS",
            provider: "CodeStarSourceConnection",
            version: "1",
          },
        ],
        name: "Source",
      },
      {
        action: [{}],
        name: "Build",
      },
      {
        action: [{}],
        name: "Deploy",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCodepipelineExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the connection to be created. The name must be unique in the calling AWS account. Changing name will create a new resource.
  • providerType - (Optional) The name of the external provider where your third-party code repository is configured. Valid values are bitbucket, gitHub or gitHubEnterpriseServer. Changing providerType will create a new resource. Conflicts with hostArn
  • hostArn - (Optional) The Amazon Resource Name (ARN) of the host associated with the connection. Conflicts with providerType
  • tags - (Optional) Map of key-value resource tags to associate with the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The codestar connection ARN.
  • arn - The codestar connection ARN.
  • connectionStatus - The codestar connection status. Possible values are pending, available and error.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

CodeStar connections can be imported using the ARN, e.g.,

$ terraform import aws_codestarconnections_connection.test-connection arn:aws:codestar-connections:us-west-1:0123456789:connection/79d4d357-a2ee-41e4-b350-2fe39ae59448