### Local Vagrant Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_vagrant_repository.md Example of how to retrieve a local vagrant repository using its key. ```hcl data "artifactory_local_vagrant_repository" "local-test-vagrant-repo" { key = "local-test-vagrant-repo" } ``` -------------------------------- ### Generic Remote Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote.md Example of how to configure a generic remote repository. Ensure the key and URL are set correctly for your environment. ```hcl resource "artifactory_remote_generic_repository" "my-remote-generic" { key = "my-remote-generic" url = "http://testartifactory.io/artifactory/example-generic/" } ``` -------------------------------- ### Local Npm Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_npm_repository.md Example of how to retrieve a local npm repository using its key. ```hcl data "artifactory_local_npm_repository" "local-test-npm-repo" { key = "local-test-npm-repo" } ``` -------------------------------- ### Artifactory Local Cran Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_cran_repository.md Basic example of creating a local Cran repository. The repository key is required. ```hcl resource "artifactory_local_cran_repository" "terraform-local-test-cran-repo" { key = "terraform-local-test-cran-repo" } ``` -------------------------------- ### Artifactory Virtual Nuget Repository Resource Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_nuget_repository.md Example of how to create a virtual Nuget repository with specified key, included repositories, patterns, and authentication settings. ```hcl resource "artifactory_virtual_nuget_repository" "foo-nuget" { key = "foo-nuget" repositories = [] description = "A test virtual repo" notes = "Internal description" includes_pattern = "com/jfrog/**,cloud/jfrog/**" excludes_pattern = "com/google/**" force_nuget_authentication = true } ``` -------------------------------- ### Get Local Helm Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_helm_repository.md Example of how to retrieve a local Helm repository using its key. ```hcl data "artifactory_local_helm_repository" "local-test-helm-repo" { key = "local-test-helm-repo" } ``` -------------------------------- ### Example Terraform Import Commands Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/v5-v6-migrator/README.md This output shows example Terraform import commands that can be generated when using the `--import` flag. ```sh terraform import artifactory_local_npm_repository.alexh-npm-local-2 alexh-npm-local-2-key terraform import artifactory_remote_npm_repository.alexh-npm-remote alexh-npm-remote-key terraform import artifactory_remote_npm_repository.alexh-npm-remote-2 alexh-npm-remote-2-key terraform import artifactory_virtual_npm_repository.alexh-npm-virtual alexh-npm-virtual-key terraform import artifactory_virtual_npm_repository.alexh-npm-virtual-2 alexh-npm-virtual-2-key ``` -------------------------------- ### Create a Virtual Helm Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_helm_repository.md Example of how to create a virtual Helm repository with a specified key and namespace usage. ```hcl resource "artifactory_virtual_helm_repository" "foo-helm-virtual" { key = "foo-helm-virtual" use_namespaces = true } ``` -------------------------------- ### Create Artifactory Local Go Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_go_repository.md Example of how to create a local Go repository. The repository key is required. ```hcl resource "artifactory_local_go_repository" "terraform-local-test-go-repo" { key = "terraform-local-test-go-repo" } ``` -------------------------------- ### Create Local NPM Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_npm_repository.md Example of how to create a basic local NPM repository. The repository key is required. ```hcl resource "artifactory_local_npm_repository" "terraform-local-test-npm-repo" { key = "terraform-local-test-npm-repo" } ``` -------------------------------- ### Generic Local Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local.md Example of how to retrieve data for a generic local Artifactory repository using its key. ```hcl data "artifactory_local_generic_repository" "local-test-generic-repo-basic" { key = "local-test-generic-repo-basic" } ``` -------------------------------- ### Get Federated Chef Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/federated_chef_repository.md Example of how to retrieve a federated Chef repository configuration using its key. ```hcl data "artifactory_federated_chef_repository" "federated-test-chef-repo" { key = "federated-test-chef-repo" } ``` -------------------------------- ### Artifactory Virtual Nix Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_nix_repository.md This example demonstrates how to create a virtual Nix repository by aggregating local and remote Nix repositories. Ensure that the local and remote repositories are defined before creating the virtual repository. ```hcl resource "artifactory_local_nix_repository" "local" { key = "nix-local" } resource "artifactory_remote_nix_repository" "remote" { key = "nix-remote" url = "https://cache.nixos.org" } resource "artifactory_virtual_nix_repository" "nix" { key = "nix-virtual" repositories = [ artifactory_local_nix_repository.local.key, artifactory_remote_nix_repository.remote.key, ] } ``` -------------------------------- ### Full HCL Example for Project and Repository Management Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/guides/repositories_in_project.md This example demonstrates how to configure Artifactory and Project resources in Terraform. It includes provider configurations, a local Docker v2 repository definition, a project resource, and a `project_repository` resource to link them. It also shows the use of `lifecycle.ignore_changes` for the `project_key` attribute. ```terraform terraform { required_providers { artifactory = { source = "jfrog/artifactory" version = "12.5.1" } project = { source = "jfrog/project" version = "1.9.1" } } } provider "artifactory" { // supply ARTIFACTORY_ACCESS_TOKEN / JFROG_ACCESS_TOKEN / ARTIFACTORY_API_KEY and ARTIFACTORY_URL / JFROG_URL as env vars } resource "artifactory_local_docker_v2_repository" "docker-v2-local" { key = "myproj-docker-v2-local" tag_retention = 3 max_unique_tags = 5 project_environments = ["PROD"] lifecycle { ignore_changes = [ project_key ] } } resource "project" "myproject" { key = "myproj" display_name = "My Project" description = "My Project" admin_privileges { manage_members = true manage_resources = true index_resources = true } max_storage_in_gibibytes = 10 block_deployments_on_limit = false email_notification = true } resource "project_repository" "myproject-docker-v2-local" { project_key = project.myproject.key key = artifactory_local_docker_v2_repository.docker-v2-local.key } ``` -------------------------------- ### Create a Virtual OCI Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_oci_repository.md Example of how to create a virtual OCI repository with specified key, repositories, and optional configurations. ```hcl resource "artifactory_virtual_oci_repository" "my-oci-virtual" { key = "my-oci-virtual" repositories = ["my-oci-local", "my-oci-remote"] description = "A test virtual OCI repo" notes = "Internal description" resolve_oci_tags_by_timestamp = true } ``` -------------------------------- ### Create Artifactory Local Chef Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_chef_repository.md Example of how to create a local Chef repository. The repository key is required. ```hcl resource "artifactory_local_chef_repository" "terraform-local-test-chef-repo" { key = "terraform-local-test-chef-repo" } ``` -------------------------------- ### Create Local Generic Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local.md Example of creating a local generic repository. The 'key' argument is mandatory and must be unique. ```hcl resource "artifactory_local_generic_repository" "terraform-local-test-generic-repo" { key = "terraform-local-test-generic-repo" } ``` -------------------------------- ### Artifactory Local Docker V2 Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_docker_v2_repository.md Example of how to create a local Docker v2 repository with specified key, tag retention, and maximum unique tags. ```hcl resource "artifactory_local_docker_v2_repository" "foo" { key = "foo" tag_retention = 3 max_unique_tags = 5 } ``` -------------------------------- ### Artifactory Property Set Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/property_set.md Example of how to configure an Artifactory Property Set resource with multiple properties, including predefined values and choice configurations. ```hcl resource "artifactory_property_set" "foo" { name = "property-set1" visible = true property { name = "set1property1" predefined_value { name = "passed-QA" default_value = true } predefined_value { name = "failed-QA" default_value = false } closed_predefined_values = true multiple_choice = true } property { name = "set1property2" predefined_value { name = "passed-QA" default_value = true } predefined_value { name = "failed-QA" default_value = false } closed_predefined_values = false multiple_choice = false } property { name = "set1property3" closed_predefined_values = false multiple_choice = false } } ``` -------------------------------- ### Artifactory Virtual SBT Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_sbt_repository.md Example of how to create a virtual SBT repository. This resource requires a unique key and can optionally include descriptions, notes, and patterns for inclusion/exclusion of artifacts. ```hcl resource "artifactory_virtual_sbt_repository" "foo-sbt" { key = "foo-sbt" repositories = [] description = "A test virtual repo" notes = "Internal description" includes_pattern = "com/jfrog/**,cloud/jfrog/**" excludes_pattern = "com/google/**" pom_repository_references_cleanup_policy = "discard_active_reference" } ``` -------------------------------- ### Example: Include All Release Bundles Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/release_bundle_v2_cleanup_policy.md Set the release bundle name to `"**"` to include all bundles in the cleanup policy. ```terraform name = "**" ``` -------------------------------- ### Local Puppet Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_puppet_repository.md Fetches the configuration for a local Puppet repository using its key. ```hcl data "artifactory_local_puppet_repository" "local-test-puppet-repo" { key = "local-test-puppet-repo" } ``` -------------------------------- ### Example: Exclude All Promoted Environments Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/release_bundle_v2_cleanup_policy.md Use `"**"` to exclude all environments from the cleanup process. ```terraform exclude_promoted_environments = ["**"] ``` -------------------------------- ### Example: Include Packages by Properties Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/package_cleanup_policy.md Delete packages that have a specific key-value property applied to their lead artifact. ```terraform included_properties = {"delete-me": ["true"]} ``` -------------------------------- ### Example Usage of Local Debian Repository Data Source Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_debian_repository.md Retrieves the configuration for a local Debian repository using its key. ```hcl data "artifactory_local_debian_repository" "local-test-debian-repo-basic" { key = "local-test-debian-repo-basic" } ``` -------------------------------- ### Artifactory Virtual RPM Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_rpm_repository.md This example demonstrates how to create a virtual RPM repository in Artifactory, including the configuration of primary and secondary GPG key pairs. It ensures that changes to the private key and passphrase of the key pairs are ignored in the Terraform state. ```hcl resource "artifactory_keypair" "primary-keypair" { pair_name = "primary-keypair" pair_type = "GPG" alias = "foo-alias-1" private_key = file("samples/gpg.priv") public_key = file("samples/gpg.pub") lifecycle { ignore_changes = [ private_key, passphrase, ] } } resource "artifactory_keypair" "secondary-keypair" { pair_name = "secondary-keypair" pair_type = "GPG" alias = "foo-alias-2" private_key = file("samples/gpg.priv") public_key = file("samples/gpg.pub") lifecycle { ignore_changes = [ private_key, passphrase, ] } } resource "artifactory_virtual_rpm_repository" "foo-rpm-virtual" { key = "foo-rpm-virtual" primary_keypair_ref = artifactory_keypair.primary-keypair.pair_name secondary_keypair_ref = artifactory_keypair.secondary-keypair.pair_name depends_on = [ artifactory_keypair.primary-keypair, artifactory_keypair.secondary-keypair, ] } ``` -------------------------------- ### Create Artifactory Remote SBT Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_sbt_repository.md Example of how to create a remote SBT repository with specified configurations. ```hcl resource "artifactory_remote_sbt_repository" "sbt-remote" { key = "sbt-remote-foo" url = "https://repo1.maven.org/maven2/" fetch_jars_eagerly = true fetch_sources_eagerly = false suppress_pom_consistency_checks = true reject_invalid_jars = true max_unique_snapshots = 10 } ``` -------------------------------- ### Create Local Puppet Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_puppet_repository.md Example of how to create a local Puppet repository using the artifactory_local_puppet_repository resource. ```hcl resource "artifactory_local_puppet_repository" "terraform-local-test-puppet-repo" { key = "terraform-local-test-puppet-repo" } ``` -------------------------------- ### Create a Remote Chef Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_chef_repository.md Example of how to create a remote Chef repository using the artifactory_remote_chef_repository resource. ```hcl resource "artifactory_remote_chef_repository" "my-remote-chef" { key = "my-remote-chef" url = "https://supermarket.chef.io" } ``` -------------------------------- ### Create Artifactory Local Maven Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_maven_repository.md Example of how to create a basic local Maven repository using the artifactory_local_maven_repository resource. ```hcl resource "artifactory_local_maven_repository" "terraform-local-test-maven-repo-basic" { key = "terraform-local-test-maven-repo-basic" checksum_policy_type = "client-checksums" snapshot_version_behavior = "unique" max_unique_snapshots = 10 handle_releases = true handle_snapshots = true suppress_pom_consistency_checks = false } ``` -------------------------------- ### Artifactory User Webhook Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/user_webhook.md Example of how to configure an Artifactory user webhook to trigger on 'locked' events. ```hcl resource "artifactory_user_webhook" "user-webhook" { key = "user-webhook" event_types = ["locked"] handler { url = "http://tempurl.org/webhook" secret = "some-secret" proxy = "proxy-key" custom_http_headers = { header-1 = "value-1" header-2 = "value-2" } } } ``` -------------------------------- ### Artifactory Remote P2 Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/remote_p2_repository.md Example of how to retrieve a remote P2 repository using its key. ```hcl data "artifactory_remote_p2_repository" "remote-p2" { key = "remote-p2" } ``` -------------------------------- ### Create Local Helm Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_helm_repository.md Example of how to create a local Helm repository with specific configurations for duplicate charts and metadata name version. ```hcl resource "artifactory_local_helm_repository" "terraform-local-test-helm-repo" { key = "terraform-local-test-helm-repo" force_non_duplicate_chart = true force_metadata_name_version = false } ``` -------------------------------- ### Artifactory Remote Peppet Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/remote_puppet_repository.md Example of how to retrieve a remote Peppet repository using its key. ```hcl data "artifactory_remote_peppet_repository" "remote-peppet" { key = "remote-peppet" } ``` -------------------------------- ### Artifactory Remote Alpine Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/remote_alpine_repository.md Example of how to retrieve a remote Alpine repository using its key. ```hcl data "artifactory_remote_alpine_repository" "remote-alpine" { key = "remote-alpine" } ``` -------------------------------- ### Example Usage of Local RPM Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_rpm_repository.md This snippet demonstrates how to create a basic local RPM repository with yum metadata calculation and file list indexing enabled. It also shows how to associate GPG keypairs for signing. ```hcl resource "artifactory_local_rpm_repository" "terraform-local-test-rpm-repo-basic" { key = "terraform-local-test-rpm-repo-basic" yum_root_depth = 5 calculate_yum_metadata = true enable_file_lists_indexing = true yum_group_file_names = "file-1.xml,file-2.xml" primary_keypair_ref = artifactory_keypair.some-keypairGPG1.pair_name secondary_keypair_ref = artifactory_keypair.some-keypairGPG2.pair_name depends_on = [ artifactory_keypair.some-keypair-gpg-1, artifactory_keypair.some-keypair-gpg-2 ] } resource "artifactory_keypair" "some-keypair-gpg-1" { pair_name = "some-keypair${random_id.randid.id}" pair_type = "GPG" alias = "foo-alias1" private_key = file("samples/gpg.priv") public_key = file("samples/gpg.pub") lifecycle { ignore_changes = [ private_key, passphrase, ] } } resource "artifactory_keypair" "some-keypair-gpg-2" { pair_name = "some-keypair${random_id.randid.id}" pair_type = "GPG" alias = "foo-alias2" private_key = file("samples/gpg.priv") public_key = file("samples/gpg.pub") lifecycle { ignore_changes = [ private_key, passphrase, ] } } ``` -------------------------------- ### Create Local Gradle Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_gradle_repository.md Example of creating a basic local Gradle repository with common configurations like checksum policy, snapshot handling, and POM consistency checks. ```hcl resource "artifactory_local_gradle_repository" "terraform-local-test-gradle-repo-basic" { key = "terraform-local-test-gradle-repo-basic" checksum_policy_type = "client-checksums" snapshot_version_behavior = "unique" max_unique_snapshots = 10 handle_releases = true handle_snapshots = true suppress_pom_consistency_checks = true } ``` -------------------------------- ### Run All Acceptance Tests with Make Source: https://github.com/jfrog/terraform-provider-artifactory/wiki/Testing An alternative method to run all acceptance tests using the 'make acceptance' command. ```shell $ make acceptance ``` -------------------------------- ### Artifactory Remote VCS Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/remote_vcs_repository.md Example of how to retrieve a remote VCS repository configuration using its key. ```hcl data "artifactory_remote_vcs_repository" "remote-vcs" { key = "remote-vcs" } ``` -------------------------------- ### Create a Remote P2 Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_p2_repository.md Example of how to create a basic remote P2 repository. Requires a unique key and the remote repository URL. ```hcl resource "artifactory_remote_p2_repository" "my-remote-p2" { key = "my-remote-p2" url = "http://testartifactory.io/artifactory/example-p2/" } ``` -------------------------------- ### Artifactory Local Composer Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_composer_repository.md Example of how to use the artifactory_local_composer_repository data source to retrieve a local composer repository. ```hcl data "artifactory_local_composer_repository" "local-test-composer-repo" { key = "local-test-composer-repo" } ``` -------------------------------- ### Install Provider Source: https://github.com/jfrog/terraform-provider-artifactory/wiki/Debugging Install the compiled provider. This command typically increments the version and ensures the local build is used instead of downloading from Terraform. ```sh # this will bump your version by 1 so it doesn't download from TF. Make sure you update any test scripts accordingly $ make install ``` -------------------------------- ### Initialize Terraform Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/README.md Command to initialize the Terraform working directory, downloading the necessary provider plugins. ```bash terraform init ``` -------------------------------- ### Artifactory Permission Target Resource Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/permission_target.md Example of creating a new Artifactory permission target with configurations for repository, build, and release bundle permissions. ```hcl # Create a new Artifactory permission target called testpermission resource "artifactory_permission_target" "test-perm" { name = "test-perm" repo { includes_pattern = ["foo/**"] excludes_pattern = ["bar/**"] repositories = ["example-repo-local"] actions { users { name = "anonymous" permissions = ["read", "write"] } users { name = "user1" permissions = ["read", "write"] } groups { name = "readers" permissions = ["read"] } groups { name = "dev" permissions = ["read", "write"] } } } build { includes_pattern = ["**"] repositories = ["artifactory-build-info"] actions { users { name = "anonymous" permissions = ["read"] } users { name = "user1" permissions = ["read", "write"] } } } release_bundle { includes_pattern = ["**"] repositories = ["release-bundles"] actions { users { name = "anonymous" permissions = ["read"] } } } } ``` -------------------------------- ### Artifactory Remote Generic Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/remote_generic_repository.md Example usage of the artifactory_remote_generic_repository data source to retrieve a remote generic repository configuration. ```hcl data "artifactory_remote_generic_repository" "remote-generic" { key = "remote-generic" } ``` -------------------------------- ### Create Release Bundle v2 using Artifacts Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/release_bundle_v2.md This example demonstrates creating a Release Bundle v2 by explicitly listing artifacts with their paths and SHA256 checksums. The 'artifacts' block within 'source' should contain these details. ```terraform resource "artifactory_release_bundle_v2" "my-release-bundle-v2-artifacts" { name = "my-release-bundle-v2-artifacts" version = "1.0.0" keypair_name = "my-keypair-name" skip_docker_manifest_resolution = true source_type = "artifacts" source = { artifacts = [{ path = "commons-qa-maven-local/org/apache/tomcat/commons/1.0.0/commons-1.0.0.jar" sha256 = "0d2053f76605e0734f5251a78c5dade5ee81b0f3730b3f603aedb90bc58033fb" }] } } ``` -------------------------------- ### Create a Federated Nuget Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/federated_nuget_repository.md Example of how to create a federated Nuget repository with specified members. Ensure the member URLs are correctly configured to point to the repository on each federated instance. ```hcl resource "artifactory_federated_nuget_repository" "terraform-federated-test-nuget-repo" { key = "terraform-federated-test-nuget-repo" member { url = "http://tempurl.org/artifactory/terraform-federated-test-nuget-repo" enabled = true } member { url = "http://tempurl2.org/artifactory/terraform-federated-test-nuget-repo-2" enabled = true } } ``` -------------------------------- ### Local OPKG Repository Data Source Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_opkg_repository.md Example of how to use the artifactory_local_opkg_repository data source to retrieve repository configuration. The 'key' attribute is required to identify the repository. ```hcl data "artifactory_local_opkg_repository" "local-test-opkg-repo" { key = "local-test-opkg-repo" } ``` -------------------------------- ### Federated Composer Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/federated_composer_repository.md Example of how to create a federated Composer repository using Terraform. Ensure the member URLs correctly point to your Artifactory instances and repository keys. ```hcl resource "artifactory_federated_composer_repository" "terraform-federated-test-composer-repo" { key = "terraform-federated-test-composer-repo" member { url = "http://tempurl.org/artifactory/terraform-federated-test-composer-repo" enabled = true } member { url = "http://tempurl2.org/artifactory/terraform-federated-test-composer-repo-2" enabled = true } } ``` -------------------------------- ### Create a Local Cargo Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_cargo_repository.md Example of how to create a basic local Cargo repository with anonymous access disabled and sparse index enabled. ```hcl resource "artifactory_local_cargo_repository" "terraform-local-test-cargo-repo-basic" { key = "terraform-local-test-cargo-repo-basic" anonymous_access = false enable_sparse_index = true } ``` -------------------------------- ### Create a Remote Conan Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_conan_repository.md Example of how to create a remote Conan repository with basic configuration. Requires a unique key and the remote repository URL. ```hcl resource "artifactory_remote_conan_repository" "my-remote-conan" { key = "my-remote-conan" url = "https://conan.io/center/" force_conan_authentication = true } ``` -------------------------------- ### Artifactory Virtual Gems Repository Resource Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/virtual_gems_repository.md Example of how to define a virtual Gems repository resource in Terraform. This includes specifying the repository key, associated repositories, and inclusion/exclusion patterns. ```hcl resource "artifactory_virtual_gems_repository" "foo-gems" { key = "foo-gems" repositories = [] description = "A test virtual repo" notes = "Internal description" includes_pattern = "com/jfrog/**,cloud/jfrog/**" excludes_pattern = "com/google/**" } ``` -------------------------------- ### Artifactory Pull Replication Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/pull_replication.md Example of creating a pull replication between two Artifactory repositories. This snippet demonstrates the configuration of local and remote Maven repositories and then sets up a pull replication between them. ```hcl # Create a replication between two artifactory local repositories resource "artifactory_local_maven_repository" "provider_test_source" { key = "provider_test_source" } resource "artifactory_remote_maven_repository" "provider_test_dest" { key = "provider_test_dest" url = "https://example.com/artifactory/${artifactory_local_maven_repository.artifactory_local_maven_repository.key}" username = "foo" password = "bar" } resource "artifactory_pull_replication" "remote-rep" { repo_key = "${artifactory_remote_maven_repository.provider_test_dest.key}" cron_exp = "0 0 * * * ?" enable_event_replication = true } ``` -------------------------------- ### Artifactory Group Resource Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/group.md This is an example of how to define an Artifactory group resource in Terraform. It includes basic configuration like name, description, external ID, admin privileges, and user assignments. ```terraform resource "artifactory_group" "test-group" { name = "terraform" description = "test group" external_id = "00628948-b509-4362-aa73-380c4dbd2a44" admin_privileges = false users_names = ["foobar"] } ``` -------------------------------- ### Example Usage of Federated Generic Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/federated_generic_repository.md This snippet demonstrates how to create a federated generic repository. It requires a repository key and a list of members, each with a URL and enabled status. The `cleanup_on_delete` and `proxy` arguments are optional. ```hcl resource "artifactory_federated_generic_repository" "terraform-federated-test-generic-repo" { key = "terraform-federated-test-generic-repo" member { url = "http://tempurl.org/artifactory/terraform-federated-test-generic-repo" enabled = true } member { url = "http://tempurl2.org/artifactory/terraform-federated-test-generic-repo-2" enabled = true } } ``` -------------------------------- ### Initialize Terraform and Upgrade Provider Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/guides/repository_v5_to_v6_migration.md Run this command to initialize your Terraform working directory and upgrade to the specified Artifactory provider version. ```bash $ terraform init -upgrade ``` -------------------------------- ### Artifactory Keypair Resource Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/keypair.md Example of how to configure an RSA key pair resource in Artifactory using Terraform. Ensure the provider version is set correctly and file paths for private and public keys are valid. ```hcl terraform { required_providers { artifactory = { source = "jfrog/artifactory" version = "9.7.0" } } } resource "artifactory_keypair" "some-keypair-6543461672124900137" { pair_name = "some-keypair-6543461672124900137" pair_type = "RSA" alias = "some-alias-6543461672124900137" private_key = file("samples/rsa.priv") public_key = file("samples/rsa.pub") passphrase = "PASSPHRASE" } ``` -------------------------------- ### Example: Repositories for Cleanup Policy Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/package_cleanup_policy.md Specify one or more repository patterns or explicit names for the cleanup policy. Use '**' to include all repositories. ```terraform repos = ["**"] ``` -------------------------------- ### Example Usage of Local Go Repository Data Source Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_go_repository.md This snippet shows how to use the data source to retrieve a local Go repository by its key. Ensure the repository key exists in Artifactory. ```hcl data "artifactory_local_go_repository" "local-test-go-repo" { key = "local-test-go-repo" } ``` -------------------------------- ### Artifactory Remote npm Repository Example Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_npm_repository.md Example of how to create a remote npm repository resource in Terraform. This configuration sets the repository key, URL, and enables listing remote folder items and overriding mismatching MIME types. ```hcl resource "artifactory_remote_npm_repository" "npm-remote" { key = "npm-remote" url = "https://registry.npmjs.org" list_remote_folder_items = true mismatching_mime_types_override_list = "application/json,application/xml" } ``` -------------------------------- ### Code of Conduct Standards Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/CONTRIBUTING.md Examples of acceptable behavior for fostering a positive environment. ```text Using welcoming and inclusive language Being respectful of differing viewpoints and experiences Gracefully accepting constructive criticism Focusing on what is best for the company Showing empathy towards other colleagues ``` -------------------------------- ### Example Usage of Local Gradle Repository Data Source Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_gradle_repository.md This snippet shows how to retrieve the configuration for a local Gradle repository using its key. ```hcl data "artifactory_local_gradle_repository" "local-test-gradle-repo-basic" { key = "local-test-gradle-repo-basic" } ``` -------------------------------- ### Example Usage of Artifactory Local Nuget Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_nuget_repository.md This snippet demonstrates how to create a basic local Nuget repository with specific configurations for maximum unique snapshots and forced authentication. ```hcl resource "artifactory_local_nuget_repository" "terraform-local-test-nuget-repo-basic" { key = "terraform-local-test-nuget-repo-basic" max_unique_snapshots = 5 force_nuget_authentication = true } ``` -------------------------------- ### Code of Conduct Unacceptable Behavior Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/CONTRIBUTING.md Examples of unacceptable behavior that violate the code of conduct. ```text The use of sexualized language or imagery and unwelcome sexual attention or advances Trolling, insulting/derogatory comments, and personal or political attacks Public or private harassment Publishing others' private information, such as a physical or electronic address, without explicit permission Other conduct which could reasonably be considered inappropriate in a professional setting ``` -------------------------------- ### Permissions Attribute Value Case in artifactory_permission_target Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/guides/permission_targets_migration.md Example of lower-case permission values in the older resource. ```terraform permissions = ["read", "write"] ``` -------------------------------- ### Example: Included Packages for Cleanup Policy Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/package_cleanup_policy.md Specify a pattern or explicit name for packages to be included in the cleanup policy. Use '**' to include all packages. ```terraform included_packages = ["**"] ``` -------------------------------- ### Create a Local Helm OCI Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_helmoci_repository.md Example of how to define a local Helm OCI repository resource with tag retention and maximum unique tags. ```hcl resource "artifactory_local_helmoci_repository" "my-helmoci-local" { key = "my-helmoci-local" tag_retention = 3 max_unique_tags = 5 } ``` -------------------------------- ### Example: Exclude Repositories from Cleanup Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/package_cleanup_policy.md Specify patterns or explicit names of repositories to be excluded from the cleanup policy. ```terraform excluded_repos = ["repo-to-exclude-*", "specific-repo-name"] ``` -------------------------------- ### Example Usage of Artifactory Local Conan Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_conan_repository.md This snippet demonstrates the basic configuration for creating a local Conan repository. It requires the repository key to be specified. ```hcl resource "artifactory_local_conan_repository" "terraform-local-test-conan-repo" { key = "terraform-local-test-conan-repo" } ``` -------------------------------- ### Create a basic remote generic repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_generic_repository.md This snippet shows how to create a simple remote generic repository with a key and URL. ```hcl resource "artifactory_remote_generic_repository" "my-remote-generic" { key = "my-remote-generic" url = "http://testartifactory.io/artifactory/example-generic/" } ``` -------------------------------- ### Example: Exclude Packages by Properties Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/package_cleanup_policy.md Exclude packages that have a specific key-value property applied to their lead artifact. ```terraform excluded_properties = {"exclude-me": ["true"]} ``` -------------------------------- ### Artifactory Remote CocoaPods Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/remote_cocoapods_repository.md Example of how to create a remote CocoaPods repository in Artifactory using Terraform. ```hcl resource "artifactory_remote_cocoapods_repository" "my-remote-cocoapods" { key = "my-remote-cocoapods" url = "https://github.com/" vcs_git_provider = "GITHUB" pods_specs_repo_url = "https://github.com/CocoaPods/Spec" } ``` -------------------------------- ### Example Usage of Local Pub Repository Data Source Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/data-sources/local_pub_repository.md This snippet shows how to retrieve a local pub repository using its key. ```hcl data "artifactory_local_pub_repository" "local-test-pub-repo" { key = "local-test-pub-repo" } ``` -------------------------------- ### Build the Migrator Binary Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/v5-v6-migrator/README.md To build the binary for the migrator tool, run the `make build` command in your shell. This requires Go 1.18 or later. ```sh make build ``` -------------------------------- ### Create Artifactory Local Opkg Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_opkg_repository.md Basic configuration to create a local Opkg repository. The repository key is required. ```hcl resource "artifactory_local_opkg_repository" "terraform-local-test-opkg-repo" { key = "terraform-local-test-opkg-repo" } ``` -------------------------------- ### Import Artifactory Property Set Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/property_set.md Example of how to import an existing Artifactory Property Set using its name. ```bash $ terraform import artifactory_property_set.foo property-set1 ``` -------------------------------- ### Import Artifactory Permission Target Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/permission_target.md Example of how to import an existing Artifactory permission target using its name. ```bash $ terraform import artifactory_permission_target.terraform-test-permission mypermission ``` -------------------------------- ### Create Artifactory Local Docker V1 Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/local_docker_v1_repository.md Example of how to create a local Docker v1 repository. The 'key' argument is required to identify the repository. ```hcl resource "artifactory_local_docker_v1_repository" "foo" { key = "foo" } ``` -------------------------------- ### Create a Federated SBT Repository Source: https://github.com/jfrog/terraform-provider-artifactory/blob/master/docs/resources/federated_sbt_repository.md Example of how to define a federated SBT repository resource with multiple members. ```hcl resource "artifactory_federated_sbt_repository" "terraform-federated-test-sbt-repo" { key = "terraform-federated-test-sbt-repo" member { url = "http://tempurl.org/artifactory/terraform-federated-test-sbt-repo" enabled = true } member { url = "http://tempurl2.org/artifactory/terraform-federated-test-sbt-repo-2" enabled = true } } ```