The terraform-aws-codeartifact module optionally creates all resources necessary for creating an AWS CodeArtifact repository, including creating a domain and KMS key for encryption.
Additionally, this module can provision a role for use by CICD systems to upload to CodeArtifact. It includes upload access to ECR as well, as these systems are often used together.
By default, the module will create an NPM repository with the public NPM repository as an external connection.
The most basic implementation creates all necessary resources for managing an NPM repository.
module "codeartifact" {
source = "github.com/catalystsquad/terraform-aws-codeartifact"
enable_codeartifact_domain_kms_key = true
codeartifact_domain_name = "mydomain"
}
module "codeartifact" {
source = "github.com/catalystsquad/terraform-aws-codeartifact"
enable_codeartifact_domain_kms_key = true
codeartifact_domain_name = "mydomain"
enable_cicd_role = true
cicd_role_trust_arns = ["arn:aws:iam::123456789999:user/my-cicd-user"]
}
Name | Version |
---|---|
terraform | >= 0.13.1 |
aws | ~> 5.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
codeartifact_domain_name | Name of CodeArtifact domain to create or reference based on var.enable_codeartifact_domain | string |
n/a | yes |
cicd_role_description | Description of the CICD role to create | string |
"Role assumed by CICD pipelines" |
no |
cicd_role_name | Name of the CICD role to create | string |
"cicd" |
no |
cicd_role_trust_arns | ARNs to trust for assume role | list(string) |
[] |
no |
codeartifact_domain_kms_key_arn | CodeArtifact domain KMS key to use if var.enable_codeartifact_domain_kms_key is disabled | string |
null |
no |
codeartifact_domain_kms_key_description | Description of KMS key to create if enabled | string |
"" |
no |
codeartifact_repositories | List of repositories to create. Defaults to NPM with public NPM external connection | list(object({ |
[ |
no |
enable_cicd_role | Enables creation of a CICD role which grants access to Code Artifact and ECR | bool |
false |
no |
enable_codeartifact_domain | Whether to enable creation of a CodeArtifact domain | bool |
true |
no |
enable_codeartifact_domain_kms_key | Whether to enable creation of a KMS key for the CodeArtifact domain | bool |
false |
no |
tags | n/a | map(string) |
{} |
no |
No outputs.
Name | Type |
---|---|
aws_codeartifact_domain.domain | resource |
aws_codeartifact_repository.repository | resource |
aws_iam_role.cicd_role | resource |
aws_kms_key.codeartifact_domain | resource |
aws_iam_policy_document.cicd_assume_role_policy | data source |
aws_iam_policy_document.cicd_codeartifact | data source |
aws_iam_policy_document.cicd_codeartifact_sts | data source |
aws_iam_policy_document.cicd_ecr | data source |
No modules.