Skip to content

uridium/terraform-jfrog-artifactory

Repository files navigation

Terraform JFrog Artifactory module

GitHub Actions Latest tag

Terraform JFrog module which creates a Local Artifactory repository.

It also creates a user with randomly generated password, a permission target, and assigns everything to the repository.

Usage

module "repository" {
  source = "git@github.com:uridium/terraform-jfrog-artifactory.git"

  key          = "go-repository"
  package_type = "go"
  description  = "Golang repository"
  email        = "contact@email.com"
}

Development

This module uses pre-commit hook to identify simple issues before pushing code to the remote repository, and relies on .pre-commit-config.yaml file.

To use it simply run:

pip install pre-commit
pre-commit install

Now pre-commit will run automatically on every git commit.

Notes

This module requires ARTIFACTORY_URL and ARTIFACTORY_ACCESS_TOKEN variables to be set up.

For example:

export ARTIFACTORY_URL="https://repo.domain.com/artifactory"
export ARTIFACTORY_ACCESS_TOKEN="<Token>"

Keep in mind that this module uses random_password resource to set up a password for artifactory_user. That means you have to treat your state file as a secret and store it in a remote S3 backend, which encrypts data at rest and in transit.

You also need to create strict IAM policies to control access to your state file.

Examples

Requirements

Name Version
terraform >= 1.2
artifactory ~> 5.0.0
random >= 3.3.0

Resources

Name Type
artifactory_local_repository.this resource
artifactory_permission_target.this resource
artifactory_user.this resource
random_password.this resource

Inputs

Name Description Type Default Required
description Repository description string n/a yes
email Repository email string n/a yes
key Repository name string n/a yes
package_type Repository package type string n/a yes
repo_layout Repository layout type map(any)
{
"alpine": "simple-default",
"bower": "bower-default",
"cargo": "cargo-default",
"chef": "simple-default",
"cocoapods": "simple-default",
"composer": "composer-default",
"conan": "conan-default",
"conda": "simple-default",
"cran": "simple-default",
"debian": "simple-default",
"docker": "simple-default",
"gems": "simple-default",
"generic": "simple-default",
"gitlfs": "simple-default",
"go": "go-default",
"gradle": "maven-2-default",
"helm": "simple-default",
"ivy": "ivy-default",
"maven": "maven-2-default",
"npm": "npm-default",
"nuget": "nuget-default",
"opkg": "simple-default",
"puppet": "puppet-default",
"pypi": "simple-default",
"rpm": "simple-default",
"sbt": "sbt-default",
"vagrant": "simple-default"
}
no
xray_index Indexing in Xray bool false no

Outputs

Name Description
repository_description Repository description
repository_key Repository name
repository_layout Repository layout type
repository_login Repository login
repository_package_type Repository package type
repository_password Repository password