Terraform provider for managing Artifactory
Manage Artifactory with Terraform
brew tap drewsonne/tap
brew install terraform-provider-artifactory
tf-install-provider artifactory
See details at https://github.com/drewsonne/homebrew-tap/blob/master/terraform-provider-artifactory.rb
provider "artifactory" {
username = "${var.artifactory_username}"
password = "${var.artifactory_password}"
url = "${var.artifactory_url}"
}
username
- (Required) Your username used to connect to Artifactory. You can
also set this via the environment variable. ARTIFACTORY_USER
password
- (Required) Your password or an API key used to connect to Artifactory. You can
also set this via the environment variable. ARTIFACTORY_PASSWORD
url
- (Required) The url to your Artifactory instance. This will typically be
everything in front of the /webapp of your web console login. For instance, Artifactory
cloud users will have a url similar to https://youraccountname.jfrog.io/youraccountname
. You can
also set this via the environment variable. ARTIFACTORY_URL
Provides support for creating groups in Artifactory.
This resource requires Artifactory Pro v2.4.0 or later.
resource "artifactory_group" "developers" {
name = "developers"
auto_join = true
}
The following arguments are supported:
name
- (Required) The name of the group.auto_join
- (Optional) Should new user’s be automatically added to this group? Default false
.realm
- (Optional) The name of the realm associated with this group (e.g. ARTIFACTORY, CROWD).realm_attributes
- (Optional) Realm attributes for use by LDAP.Provides support for setting up local repositories in Artifactory.
# A Sample NPM registry
resource "artifactory_local_repository" "localnpm" {
key = "npm-local"
package_type = "npm"
repository_layout_ref = "npm-default"
property_sets = [ "artifactory" ]
}
# A Docker repository
resource "artifactory_local_repository" "docker" {
key = "docker-local"
package_type = "docker"
repository_layout_ref = "simple-default"
docker_api_version = "V2"
property_sets = [ "artifactory" ]
}
The following arguments are supported:
key
- (Required) The key of the repository.package_type
- (Optional) The type of the repository. One of (maven
, gradle
, ivy
, sbt
,nuget
, gems
, npm
, bower
, debian
, composer
, pypi
, docker
, vagrant
, gitlfs
, yum
,conan
, or generic
). Default is generic
.description
- (Optional) Description of the repository.notes
- (Optional) Notes about the repository.repo_layout_ref
- (Optional) The layout of the repository. The fullmaven-2-default
.includes_pattern
- (Optional) List of artifact patterns to include when evaluating artifact**/*
.excludes_pattern
- (Optional) List of artifact patterns to exclude when evaluating artifacthandle_releases
- (Optional) Defaults to true
.handle_snapshots
- (Optional) Defaults to true
.max_unique_snapshots
- (Optional)max_unique_tags
- (Optional) debian_trivial_layout
- (Optional) When set, the repository will use the deprecated trivial layout.false
.checksum_policy_type
- (Optional) One of client-checksums
, or server-generated-checksums
. Defaults to client-checksums
.snapshot_version_behavior
- (Optional) One of unique
, non-unique
, or deployer
. Defaults to non-unique
.suppress_pom_consistency_checks
- (Optional) Defaults to false
.blacked_out
- (Optional) When set, the repository does not participate in artifact resolution andfalse
.property_sets
- (Optional) List of property sets to apply to the repository.archive_browsing_enabled
- (Optional) When set, you may view content such as HTML or Javadocfalse
.calculate_yum_metadata
- (Optional) Defaults to false
.yum_root_depth
- (Optional) Defaults to 0
.docker_api_version
- (Optional) Docker API compatibility. Must be V1
or V2
. Defaults to V2
.Provides support for setting up remote repositories in Artifactory.
A remote repository serves as a caching proxy for a repository managed at a remote URL
(which may itself be another Artifactory remote repository).
Artifacts are stored and updated in remote repositories according to various configuration
parameters that control the caching and proxying behavior. You can remove artifacts
from a remote repository cache but you cannot actually deploy a new artifact into a
remote repository.
# Manage your repository
resource "artifactory_remote_repository" "publicnpm" {
key = "registry.npmjs.org"
package_type = "npm"
description = "Proxy public npm registry"
repo_layout_ref = "npm-default"
url = "https://registry.npmjs.org/"
property_sets = [
"artifactory"
]
}
The following arguments are supported:
key
- (Required) The key of the repository.package_type
- (Optional) The type of the repository. One of (maven
, gradle
, ivy
, sbt
,nuget
, gems
, npm
, bower
, debian
, composer
, pypi
, docker
, vagrant
, gitlfs
, yum
,conan
, or generic
). Default is generic
.repositories
- (Optional) The upstream repositories to pull from.default_deployment_repo
- (Optional) The local repo this repository will push to.description
- (Optional) Description of the repository.notes
- (Optional) Notes about the repository.repo_layout_ref
- (Optional) The layout of the repository. The fullmaven-2-default
.includes_pattern
- (Optional) List of artifact patterns to include when evaluating artifact**/*
.excludes_pattern
- (Optional) List of artifact patterns to exclude when evaluating artifacthandle_releases
- (Optional) Defaults to true
.handle_snapshots
- (Optional) Defaults to true
.max_unique_snapshots
- (Optional)suppress_pom_consistency_checks
- (Optional)url
- (Optional) URL of the upstream remote repository.username
- (Optional) The username to use to authenticate to the upstream remote repository.password
- (Optional) The password to use to authenticate to the upstream remote repository.proxy
- (Optional)remote_repo_checksum_policy_type
- (Optional)hard_fail
- (Optional)offline
- (Optional) If set, Artifactory does not try to fetch remote artifacts.false
.blacked_out
- (Optional) When set, the repository does not participate in artifact resolution andfalse
.property_sets
- (Optional) List of property sets to apply to the repository.store_artifacts_locally
- (Optional) When set, the repository should store cached artifactstrue
.socket_timeout_millis
- (Optional) Network timeout (in ms) to use when establishing a connection15000
.local_address
- (Optional) The local address to be used when creating connections. Useful forretrieval_cache_period_seconds
- (Optional) This value refers to the number of seconds to600
.failed_cache_period_seconds
- (Optional) Defaults to 0
.missed_cache_period_seconds
- (Optional) The number of seconds to cache artifact retrieval misses (artifact not found).1800
.unused_artifacts_cleanup_enabled
- (Optional) Defaults to false
.unused_artifacts_cleanup_period_hours
- (Optional) The number of hours to wait before an0
means automatic cleanup of cached artifacts is disabled. Defaults to 0
.fetch_jars_eagerly
- (Optional) Defaults to false
.fetch_sources_eagerly
- (Optional) Defaults to false
.share_configuration
- (Optional) Defaults to false
.synchronize_properties
- (Optional) When set, remote artifacts are fetched along with theirfalse
.allow_any_host_auth
- (Optional) Defaults to false
.enable_cookie_management
- (Optional) Enables cookie management if the remote repository usesfalse
.bower_registry_url
- (Optional)vcs_type
- (Optional) When present, must be GIT
.vcs_git_provider
- (Optional) Should be one of GITHUB
, BITBUCKET
,STASH
, ARTIFACTORY
, CUSTOM
. Defaults to GITHUB
.vcs_git_download_url
- (Optional)Provides support for creating users in Artifactory.
This resource does not allow setting of the user’s password.
Instead, a random password is generated for each user. The user should do a
forgot my password to reset their password. On updates, the password is set,
then immediately expired. This should trigger an email to the user if Artifactory is configured to.
resource "artifactory_user" "walter" {
name = "walter.sobchak"
email = "walter.sobchak@sobchaksecurity.com"
is_admin = true
groups = [ "readers", "publishers" ]
}
The following arguments are supported:
name
- (Required) The name of the user.email
- (Required) The user’s email address.is_admin
- (Optional) Does this user have admin privileges. Default false
.is_updatable
- (Optional) Can this user update their profile?. Cannot be false
true
. Default true
.groups
- (Optional) An array of groups this user belongs to.realm
- (Computed) The realm the user belongs to.Provides support for setting up virtual repositories in Artifactory.
Virtual repositories are used to mirror public repositories, while adding
push capabilities. Configure a virtual repository to pull from multiple repositories
and push to a single local repository.
# Create a virtual repository that mirrors public, and pushes to a local
resource "artifactory_virtual_repository" "gems" {
key = "gems"
package_type = "gem"
description = "Gem Repository"
repositories = [
"org-rubygems-cache",
"gems-local"
]
repo_layout_ref = "simple-default"
default_deployment_repo = "gems-local"
}
The following arguments are supported:
key
- (Required) The key of the repository.package_type
- (Optional) The type of the repository. One of (maven
, gradle
, ivy
, sbt
,nuget
, gems
, npm
, bower
, debian
, composer
, pypi
, docker
, vagrant
, gitlfs
, yum
,conan
, or generic
). Default is generic
.repositories
- (Optional) The upstream repositories to pull from.default_deployment_repo
- (Optional) The local repo this repository will push to.description
- (Optional) Description of the repository.notes
- (Optional) Notes about the repository.repo_layout_ref
- (Optional) The layout of the repository. The fullmaven-2-default
.includes_pattern
- (Optional) List of artifact patterns to include when evaluating artifact**/*
.excludes_pattern
- (Optional) List of artifact patterns to exclude when evaluating artifactdebian_trivial_layout
- (Optional) When set, the repository will use the deprecated trivial layout.false
.artifactory_requests_can_retrieve_remote_artifacts
- (Optional) Determines whether artifactfalse
.key_pair
- (Optional)pom_repository_references_cleanup_policy
- (Optional) Should be one of discard_active_reference
,discard_any_reference
, nothing
.