### Get All Repositories Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_list.md Use this data source to retrieve a list of all repositories. No additional setup is required. ```terraform data "nexus_repository_list" "all" {} ``` -------------------------------- ### Start Nexus Services for Testing Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/README.md Start local Docker containers for Nexus and MinIO using make. This exposes ports 8081 and 9000 for testing. ```bash make start-services ``` -------------------------------- ### Get an existing apt repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_apt_hosted.md Use this data source to get an existing apt repository. It requires the repository name. ```terraform data "nexus_repository_apt_hosted" "bullseye_stable" { name = "bullseye-stable" } ``` -------------------------------- ### Import Docker Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_docker_proxy.md Example of importing a Docker proxy repository using its name. ```shell # import using the name of repository terraform import nexus_repository_docker_proxy.dockerhub dockerhub ``` -------------------------------- ### Get Raw Group Repository - Example Usage Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_raw_group.md Use this data source to get an existing raw group repository by its name. Ensure the repository exists before querying. ```terraform data "nexus_repository_raw_group" "raw_public" { name = "raw-public" } ``` -------------------------------- ### Run Terraform Commands Locally Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/README.md Execute Terraform plan and apply commands after setting up local development overrides and starting Nexus services. ```bash # start local nexus make start-services # run local terraform code cd examples/local-development terraform plan terraform apply ``` -------------------------------- ### Data Source: nexus_repository_apt_hosted Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_apt_hosted.md Use this data source to get information about an existing apt hosted repository in Nexus. ```APIDOC ## Data Source nexus_repository_apt_hosted Use this data source to get an existing apt repository. ### Example Usage ```terraform data "nexus_repository_apt_hosted" "bullseye_stable" { name = "bullseye-stable" } ``` ## Schema ### Required - `name` (String) A unique identifier for this repository ### Read-Only - `cleanup` (List of Object) Cleanup policies (see [below for nested schema](#nestedatt--cleanup)) - `component` (List of Object) Component configuration for the hosted repository (see [below for nested schema](#nestedatt--component)) - `distribution` (String) Distribution to fetch - `id` (String) Used to identify data source at nexus - `online` (Boolean) Whether this repository accepts incoming requests - `signing` (List of Object) Contains signing data of repositores (see [below for nested schema](#nestedatt--signing)) - `storage` (List of Object) The storage configuration of the repository (see [below for nested schema](#nestedatt--storage)) ### Nested Schema for `cleanup` Read-Only: - `policy_names` (Set of String) ### Nested Schema for `component` Read-Only: - `proprietary_components` (Boolean) ### Nested Schema for `signing` Read-Only: - `keypair` (String) - `passphrase` (String) ### Nested Schema for `storage` Read-Only: - `blob_store_name` (String) - `strict_content_type_validation` (Boolean) - `write_policy` (String) ``` -------------------------------- ### Import a PyPI Group Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_pypi_group.md This example shows how to import an existing PyPI group repository into Terraform state using its name. ```shell # import using the name of repository terraform import nexus_repository_pypi_group.group pypi-group ``` -------------------------------- ### Create an Apt Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_apt_proxy.md Use this resource to create a hosted apt repository. Ensure all required fields like name, distribution, storage, proxy, and http_client are configured. ```terraform resource "nexus_repository_apt_proxy" "bionic_proxy" { name = "bionic-proxy" online = true routing_rule = "string" distribution = "bionic" flat = false storage { blob_store_name = "default" strict_content_type_validation = true } proxy { remote_url = "https://remote.repository.com" content_max_age = 1440 metadata_max_age = 1440 } negative_cache { enabled = true ttl = 1440 } http_client { blocked = false auto_block = true connection { retries = 0 user_agent_suffix = "string" timeout = 60 enable_circular_redirects = false enable_cookies = false use_trust_store = false } authentication { type = "username" username = "admin" password = "admin-password" } } } ``` -------------------------------- ### Create Nexus Script and Privilege Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/privilege_script.md Use this example to create a Nexus script and then define a privilege for that script. Ensure the script is defined before the privilege that references it. ```terraform resource "nexus_script" "example" { name = "example_script" content = "log.info('Hello, World!')" } resource "nexus_privilege_script" "example" { name = "example_privilege" description = "description" actions = ["ADD", "READ", "DELETE", "RUN", "BROWSE", "EDIT"] script_name = resource.nexus_script.example.name } ``` -------------------------------- ### Get Maven Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_maven_proxy.md Use this data source to get an existing maven proxy repository by its name. ```terraform data "nexus_repository_maven_proxy" "maven_central" { name = "maven-central" } ``` -------------------------------- ### Get Hosted Nuget Repository - Terraform Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_nuget_hosted.md Use this data source to get an existing hosted nuget repository by its name. ```terraform data "nexus_repository_nuget_hosted" "nuget" { name = "nuget" } ``` -------------------------------- ### Initialize and Apply Terraform Configuration Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/examples/blobstore-s3/README.md Use these commands to initialize your Terraform project, plan the changes, and apply them to create AWS resources for Nexus S3 blobstore. ```bash cd terraform terraform init terraform plan -var-file=./example.tfvars -out example.tfplan terraform apply example.tfvars ``` -------------------------------- ### Get a repository view privilege Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/privilege_repository_view.md Use this data source to get a privilege for a repository view. Requires the privilege name. ```terraform data "nexus_privilege_repository_view" "example" { name = "privilege_name" } ``` -------------------------------- ### Create a PyPI Group Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_pypi_group.md This example demonstrates how to create a PyPI group repository named 'pypi-group'. It includes configurations for hosted and proxy repositories as members of this group. ```terraform resource "nexus_repository_pypi_hosted" "internal" { name = "internal" online = true storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } resource "nexus_repository_pypi_proxy" "pypi_org" { name = "pypi-org" online = true storage { blob_store_name = "default" strict_content_type_validation = true } proxy { remote_url = "https://pypi.org" content_max_age = 1440 metadata_max_age = 1440 } negative_cache { enabled = true ttl = 1440 } http_client { blocked = false auto_block = true } } resource "nexus_repository_pypi_group" "group" { name = "pypi-group" online = true group { member_names = [ nexus_repository_pypi_hosted.internal.name, nexus_repository_pypi_proxy.pypi_org.name, ] } storage { blob_store_name = "default" strict_content_type_validation = true } } ``` -------------------------------- ### Get Yum Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_yum_proxy.md Use this data source to get an existing yum proxy repository. It requires the repository name. ```terraform data "nexus_repository_yum_proxy" "centos" { name = "centos" } ``` -------------------------------- ### Create a hosted Nuget repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_nuget_hosted.md Use this resource to create a hosted Nuget repository. Ensure the blob store 'default' exists and is configured appropriately. ```terraform resource "nexus_repository_nuget_hosted" "internal" { name = "nuget-internal" online = true storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` -------------------------------- ### Create a basic hosted yum repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_yum_hosted.md This snippet shows the minimal configuration required to create a hosted yum repository. It only specifies the repository name. ```terraform resource "nexus_repository_yum_hosted" "yum" { name = "yummy" } ``` -------------------------------- ### Get a raw proxy repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_raw_proxy.md Use this data source to get an existing raw proxy repository. It requires the repository name. ```terraform data "nexus_repository_raw_proxy" "raw_org" { name = "raw-org" } ``` -------------------------------- ### Generate Terraform Documentation Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/README.md Generate Terraform documentation from Go files using the make docs command. Ensure resources and data sources are updated accordingly. ```bash make docs ``` -------------------------------- ### Get Nuget Group Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_nuget_group.md Use this data source to get an existing nuget group repository. Requires the repository name. ```terraform data "nexus_repository_nuget_group" "group" { name = "nuget-group" } ``` -------------------------------- ### Get a repository admin privilege Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/privilege_repository_admin.md Use this data source to get a privilege for a repository admin. Provide the name of the privilege to retrieve its details. ```terraform data "nexus_privilege_repository_admin" "example" { name = "privilege_name" } ``` -------------------------------- ### Get Hosted Yum Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_yum_hosted.md Use this data source to get an existing hosted yum repository. The 'name' argument is required to identify the repository. ```terraform data "nexus_repository_yum_hosted" "yummy" { name = "yummy" } ``` -------------------------------- ### Create a Hosted APT Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_apt_hosted.md Use this Terraform resource to create a hosted APT repository in Nexus. Configure repository name, online status, distribution, signing details (keypair and passphrase), and storage settings including blob store name and write policy. ```terraform resource "nexus_repository_apt_hosted" "bullseye_stable" { name = "bullseye-stable" online = true distribution = "bullseye" signing { # The passphrase set here will never be returned from the nexus API. # When reading the resource, the passphrase will be read from the previous state, # so external changes won't be detected. # If the passphrase is unset or empty, the nexus API will also not return the keypair. # When reading the resource, the keypair will be read from the previous state in this case, # so external changes won't be detected. keypair = "keypair" passphrase = "passphrase" } storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` -------------------------------- ### Create a Rubygems Group Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_rubygems_group.md This example demonstrates how to create a Rubygems group repository, including its hosted and proxy members. Ensure the member repositories are defined before this resource. ```terraform resource "nexus_repository_rubygems_hosted" "internal" { name = "internal" online = true storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } resource "nexus_repository_rubygems_proxy" "rubygems_org" { name = "rubygems-org" online = true storage { blob_store_name = "default" strict_content_type_validation = true } proxy { remote_url = "https://rubygems.org" content_max_age = 1440 metadata_max_age = 1440 } negative_cache { enabled = true ttl = 1440 } http_client { blocked = false auto_block = true } } resource "nexus_repository_rubygems_group" "group" { name = "rubygems-group" online = true group { member_names = [ nexus_repository_rubygems_hosted.internal.name, nexus_repository_rubygems_proxy.rubygems_org.name, ] } storage { blob_store_name = "default" strict_content_type_validation = true } } ``` -------------------------------- ### Get an r proxy repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_r_proxy.md Use this data source to get an existing r proxy repository by its name. Ensure the repository exists before querying. ```terraform data "nexus_repository_r_proxy" "r_org" { name = "r-org" } ``` -------------------------------- ### Resource nexus_repository_apt_hosted Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_apt_hosted.md This resource allows you to create and manage a hosted APT repository in Nexus. It covers essential configurations like repository name, distribution, signing credentials, and storage details. ```APIDOC ## Resource nexus_repository_apt_hosted Use this resource to create a hosted apt repository. ### Description This resource defines a hosted APT repository in Nexus. It allows for configuration of repository name, distribution, signing keys, and storage settings. ### Method Not Applicable (Terraform Resource) ### Endpoint Not Applicable (Terraform Resource) ### Parameters #### Path Parameters - **id** (String) - Read-Only - Used to identify resource at nexus #### Query Parameters None #### Request Body ##### `nexus_repository_apt_hosted` (Resource) - **name** (String) - Required - A unique identifier for this repository - **online** (Boolean) - Optional - Whether this repository accepts incoming requests - **distribution** (String) - Required - Distribution to fetch - **signing** (Block List, Min: 1, Max: 1) - Required - Signing contains signing data of hosted repositories of format Apt - **keypair** (String, Sensitive) - Required - PGP signing key pair (armored private key e.g. gpg --export-secret-key --armor) - **passphrase** (String, Sensitive) - Optional - Passphrase to access PGP signing key. - **storage** (Block List, Min: 1, Max: 1) - Required - The storage configuration of the repository - **blob_store_name** (String) - Required - Blob store used to store repository contents - **strict_content_type_validation** (Boolean) - Required - Whether to validate uploaded content's MIME type appropriate for the repository format - **write_policy** (String) - Optional - Controls if deployments of and updates to assets are allowed (e.g., "ALLOW", "REJECT") - **cleanup** (Block List) - Optional - Cleanup policies - **policy_names** (Set of String) - Optional - List of policy names - **component** (Block List, Max: 1) - Optional - Component configuration for the hosted repository - **proprietary_components** (Boolean) - Required - Components in this repository count as proprietary for namespace conflict attacks (requires Sonatype Nexus Firewall) ### Request Example ```terraform resource "nexus_repository_apt_hosted" "bullseye_stable" { name = "bullseye-stable" online = true distribution = "bullseye" signing { keypair = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n...\n-----END PGP PRIVATE KEY BLOCK-----" passphrase = "your_passphrase" } storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` ### Response #### Success Response (200) - **id** (String) - The unique identifier of the created repository. #### Response Example ```json { "id": "bullseye-stable" } ``` ### Import Import is supported using the following syntax: ```shell terraform import nexus_repository_apt_hosted.bullseye_stable bullseye-stable ``` ``` -------------------------------- ### Get Nuget Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_nuget_proxy.md Use this data source to get an existing nuget proxy repository. The `name` attribute is required to identify the repository. ```terraform data "nexus_repository_nuget_proxy" "nuget_org" { name = "nuget-org" } ``` -------------------------------- ### Get Hosted R Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_r_hosted.md Use this data source to get an existing hosted R repository by its name. Ensure the repository name is unique. ```terraform data "nexus_repository_r_hosted" "hosted" { name = "r-internal" } ``` -------------------------------- ### Create a hosted Npm repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_npm_hosted.md Use this resource to create a hosted Npm repository. The basic configuration requires a name. Optional configurations include online status, cleanup policies, and storage details. ```terraform resource "nexus_repository_npm_hosted" "npm" { name = "npm" } resource "nexus_repository_npm_hosted" "npm1" { name = "npm1" online = true cleanup { policy_names = ["policy"] } storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` -------------------------------- ### Create Nexus Role with Privileges Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/security_role.md This example demonstrates creating a Nexus Role focused on specific privileges, such as Docker repository access. The `privileges` argument is crucial for defining granular permissions. ```terraform # Example Usage - Create a group with privileges resource "nexus_security_role" "docker_deploy" { description = "Docker deployment role" name = "docker-deploy" privileges = [ "nx-repository-view-docker-*-*", ] roleid = "docker-deploy" } ``` -------------------------------- ### Get an r group repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_r_group.md Use this data source to get an existing r group repository by its name. Ensure the repository name is unique. ```terraform data "nexus_repository_r_group" "group" { name = "r-group" } ``` -------------------------------- ### Import a Hosted APT Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_apt_hosted.md Import an existing hosted APT repository into Terraform management by providing its name. This command assumes the repository already exists in Nexus. ```shell # import using the name of repository terraform import nexus_repository_apt_hosted.bullseye_stable bullseye-stable ``` -------------------------------- ### Get npm proxy repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_npm_proxy.md Use this data source to get an existing npm proxy repository. The `name` attribute is required to identify the repository. ```terraform data "nexus_repository_npm_proxy" "npmjs" { name = "npmjs" } ``` -------------------------------- ### Get an npm group repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_npm_group.md Use this data source to get an existing npm group repository by its name. Ensure the repository exists before querying. ```terraform data "nexus_repository_npm_group" "group" { name = "npm-group" } ``` -------------------------------- ### Get Hosted Helm Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_helm_hosted.md Use this data source to get an existing hosted yum repository. Specify the name of the repository to retrieve its configuration. ```terraform data "nexus_repository_helm_hosted" "internal" { name = "helm-internal" } ``` -------------------------------- ### Create a Nexus File Blobstore Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/blobstore_file.md Use this resource to create a Nexus file blobstore. Configure the name, path, and optional soft quota. ```terraform resource "nexus_blobstore_file" "file" { name = "blobstore-file" path = "/nexus-data/blobstore-file" soft_quota { limit = 1024000000 type = "spaceRemainingQuota" } } ``` -------------------------------- ### Get Go Group Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_go_group.md Use this data source to get an existing go group repository by its name. Ensure the repository exists before querying. ```terraform data "nexus_repository_go_group" "go_public" { name = "go-public" } ``` -------------------------------- ### Create a hosted Helm repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_helm_hosted.md Use this resource to create a hosted Helm repository. Ensure the 'name' and 'storage' blocks are configured correctly. ```terraform resource "nexus_repository_helm_hosted" "internal" { name = "helm-internal" online = true storage { blob_store_name = "default" strict_content_type_validation = false write_policy = "ALLOW" } } ``` -------------------------------- ### Get an existing bower proxy repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_bower_proxy.md Use this data source to get an existing bower proxy repository. The `name` attribute is required to identify the repository. ```terraform data "nexus_repository_bower_proxy" "bower_org" { name = "bower-org" } ``` -------------------------------- ### Create a hosted Git LFS repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_gitlfs_hosted.md Use this resource to create a hosted Git LFS repository. Ensure the blob store exists and configure storage options like blob store name and write policy. ```terraform resource "nexus_repository_gitlfs_hosted" "internal" { name = "gitlfs-internal" online = true storage { blob_store_name = "default" strict_content_type_validation = false write_policy = "ALLOW" } } ``` -------------------------------- ### Create a Docker Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_docker_group.md Use this resource to create a Docker proxy repository. Configure the 'docker', 'docker_proxy', 'storage', 'proxy', 'negative_cache', and 'http_client' blocks as needed. ```terraform resource "nexus_repository_docker_proxy" "dockerhub" { name = "dockerhub" docker { force_basic_auth = false v1_enabled = false subdomain = "docker" } docker_proxy { index_type = "HUB" } storage { blob_store_name = "default" strict_content_type_validation = true } proxy { remote_url = "https://registry-1.docker.io" content_max_age = 1440 metadata_max_age = 1440 } negative_cache { enabled = true ttl = 1440 } http_client { blocked = false auto_block = true } } ``` -------------------------------- ### Get Nexus Azure Blobstore Details Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/blobstore_azure.md Use this data source to get details of an existing Nexus Azure blobstore. The 'name' attribute is required to identify the blobstore. ```terraform data "nexus_blobstore_azure" "example" { name = "example" } ``` -------------------------------- ### Create a hosted Rubygems repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_rubygems_hosted.md Use this resource to create a hosted Rubygems repository. Ensure the blob store exists and configure storage settings like blob store name and write policy. ```terraform resource "nexus_repository_rubygems_hosted" "internal" { name = "rubygems-internal" online = true storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` -------------------------------- ### Get Bower Group Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_bower_group.md Use this data source to get an existing bower group repository. This data source is deprecated and will be removed in the next major release of this provider. ```terraform data "nexus_repository_bower_group" "group" { name = "bower-group" } ``` -------------------------------- ### Data Source: nexus_privilege_script Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/privilege_script.md Use this data source to get a privilege for a script. ```APIDOC ## Data Source nexus_privilege_script Use this data source to get a privilege for a script. ### Example Usage ```terraform data "nexus_privilege_script" "example" { name = "privilege-name" } ``` ## Schema ### Required - `name` (String) Name of the script privilege ### Read-Only - `actions` (List of String) A list of allowed actions. For a list of applicable values see https://help.sonatype.com/repomanager3/nexus-repository-administration/access-control/privileges#Privileges-PrivilegeTypes - `description` (String) Description of the script privilege - `id` (String) Used to identify data source at nexus - `readonly` (Boolean) Whether it is readonly or not - `script_name` (String) The script the privilege applies to ``` -------------------------------- ### Configure Nexus Provider (Basic) Source: https://context7.com/datadrivers/terraform-provider-nexus/llms.txt Basic provider configuration with connection details and authentication. Use 'insecure = true' only for testing, not production. ```terraform provider "nexus" { url = "https://nexus.example.com:8080" username = "admin" password = "admin123" insecure = true # Skip TLS verification (use false in production) timeout = 30 # Connection timeout in seconds } ``` -------------------------------- ### Data Source nexus_security_role Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/security_role.md Use this data source to get a specified security role. ```APIDOC ## Data Source nexus_security_role ### Description Use this to get a specified security role. ### Method GET ### Endpoint /api/v1/security/roles/{roleid} ### Parameters #### Path Parameters - **roleid** (String) - Required - The ID of the role to retrieve. ### Response #### Success Response (200) - **id** (String) - The unique identifier of the role. - **name** (String) - The name of the role. - **description** (String) - The description of the role. - **privileges** (Set of String) - A set of privileges associated with the role. - **roles** (Set of String) - A set of roles that this role is a member of. ### Request Example ```terraform data "nexus_security_role" "nx_admin" { roleid = "nx-admin" } ``` ### Response Example ```json { "id": "nx-admin", "name": "nx-admin", "description": "Nexus Administrator Role", "privileges": [ "nx-user-view", "nx-role-edit" ], "roles": [] } ``` ``` -------------------------------- ### Create a PyPI Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_pypi_proxy.md Use this resource to create a PyPI proxy repository. Configure storage, proxy settings, negative caching, and HTTP client options. ```terraform resource "nexus_repository_pypi_proxy" "pypi_org" { name = "pypi-org" online = true storage { blob_store_name = "default" strict_content_type_validation = true } proxy { remote_url = "https://pypi.org" content_max_age = 1440 metadata_max_age = 1440 } negative_cache { enabled = true ttl = 1440 } http_client { blocked = false auto_block = true } } ``` -------------------------------- ### Data Source: nexus_privilege_repository_view Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/privilege_repository_view.md Use this data source to get a privilege for a repository view. ```APIDOC ## Data Source nexus_privilege_repository_view ### Description Use this data source to get a privilege for a repository view. ### Method GET ### Endpoint /api/v1/privileges/repository_view/{name} ### Parameters #### Path Parameters - **name** (String) - Required - Name of the application privilege ### Response #### Success Response (200) - **actions** (List of String) - A list of allowed actions. For a list of applicable values see https://help.sonatype.com/repomanager3/nexus-repository-administration/access-control/privileges#Privileges-PrivilegeTypes - **description** (String) - Description of the application privilege - **format** (String) - The format of the referenced Repository - **id** (String) - Used to identify data source at nexus - **readonly** (Boolean) - Whether it is readonly or not - **repository** (String) - Name of the repository the privilege applies to ### Request Example ```terraform data "nexus_privilege_repository_view" "example" { name = "privilege_name" } ``` ### Response Example ```json { "id": "privilege_id", "name": "privilege_name", "description": "Description of the privilege", "actions": ["read", "write"], "repository": "repository_name", "format": "maven2", "readonly": false } ``` ``` -------------------------------- ### Create a hosted yum repository with advanced configuration Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_yum_hosted.md This snippet demonstrates a more comprehensive configuration for a hosted yum repository, including deployment policy, online status, repodata depth, cleanup policies, and detailed storage settings. ```terraform resource "nexus_repository_yum_hosted" "yum1" { deploy_policy = "STRICT" name = "yummy1" online = true repodata_depth = 4 cleanup { policy_names = ["policy"] } storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` -------------------------------- ### Create a Bower Proxy Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_bower_proxy.md Use this resource to create a bower proxy repository. Ensure all required fields like name, storage, and proxy configurations are provided. The http_client and negative_cache blocks are also mandatory. ```terraform resource "nexus_repository_bower_proxy" "bower_io" { name = "bower-io" online = true rewrite_package_urls = true storage { blob_store_name = "default" strict_content_type_validation = true } proxy { remote_url = "https://registry.bower.io" content_max_age = 1440 metadata_max_age = 1440 } negative_cache { enabled = true ttl = 1440 } http_client { blocked = false auto_block = true } } ``` -------------------------------- ### Get nexus_routing_rule Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/routing_rule.md Use this data source to retrieve information about a specific routing rule by its name. ```terraform data "nexus_routing_rule" "stop_leaks" { name = "stop-leaks" } ``` -------------------------------- ### Create a Docker Hosted Repository Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/repository_docker_group.md Use this resource to create a Docker hosted repository. Ensure the 'docker' and 'storage' blocks are configured appropriately. ```terraform resource "nexus_repository_docker_hosted" "internal" { name = "internal" docker { force_basic_auth = false v1_enabled = false subdomain = "docker" # Pro-only } storage { blob_store_name = "default" strict_content_type_validation = true write_policy = "ALLOW" } } ``` -------------------------------- ### Data Source nexus_repository_pypi_proxy Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_pypi_proxy.md Use this data source to get an existing pypi proxy repository. ```APIDOC ## Data Source nexus_repository_pypi_proxy ### Description Use this data source to get an existing pypi proxy repository. ### Method GET ### Endpoint /api/v1/repositories/pypi/proxy/{name} ### Parameters #### Path Parameters - **name** (String) - Required - The name of the PyPI proxy repository to retrieve. ### Response #### Success Response (200) - **id** (String) - Used to identify data source at nexus - **name** (String) - A unique identifier for this repository - **online** (Boolean) - Whether this repository accepts incoming requests - **storage** (List of Object) - The storage configuration of the repository - **blob_store_name** (String) - The name of the blob store used for storage. - **strict_content_type_validation** (Boolean) - Whether to enforce strict content type validation. - **proxy** (List of Object) - Configuration for the proxy repository - **remote_url** (String) - The URL of the remote repository. - **content_max_age** (Number) - The maximum age of content in the cache in seconds. - **metadata_max_age** (Number) - The maximum age of metadata in the cache in seconds. - **negative_cache** (List of Object) - Configuration of the negative cache handling - **enabled** (Boolean) - Whether the negative cache is enabled. - **ttl** (Number) - The time-to-live for negative cache entries in seconds. - **cleanup** (List of Object) - Cleanup policies - **policy_names** (Set of String) - The names of the cleanup policies to apply. - **http_client** (List of Object) - HTTP Client configuration for proxy repositories - **authentication** (List of Object) - Authentication configuration for the HTTP client - **type** (String) - The type of authentication. - **username** (String) - The username for authentication. - **password** (String) - The password for authentication. - **ntlm_domain** (String) - The NTLM domain for authentication. - **ntlm_host** (String) - The NTLM host for authentication. - **auto_block** (Boolean) - Whether to automatically block the repository on connection errors. - **blocked** (Boolean) - Whether the HTTP client is blocked. - **connection** (List of Object) - Connection configuration for the HTTP client - **retries** (Number) - The number of retries for connection attempts. - **timeout** (Number) - The timeout for connection attempts in seconds. - **user_agent_suffix** (String) - A suffix to append to the User-Agent header. - **enable_circular_redirects** (Boolean) - Whether to enable circular redirects. - **enable_cookies** (Boolean) - Whether to enable cookie handling. - **use_trust_store** (Boolean) - Whether to use the system trust store. - **routing_rule** (String) - The name of the routing rule assigned to this repository ### Request Example ```terraform data "nexus_repository_pypi_proxy" "pypi_org" { name = "pypi-org" } ``` ### Response Example ```json { "id": "some-id", "name": "pypi-org", "online": true, "storage": [ { "blob_store_name": "default", "strict_content_type_validation": false } ], "proxy": [ { "remote_url": "https://pypi.org/", "content_max_age": 1440, "metadata_max_age": 1440 } ], "negative_cache": [ { "enabled": true, "ttl": 1440 } ], "cleanup": [ { "policy_names": [] } ], "http_client": [ { "authentication": [], "auto_block": false, "blocked": false, "connection": [ { "retries": 0, "timeout": 0, "user_agent_suffix": null, "enable_circular_redirects": false, "enable_cookies": false, "use_trust_store": false } ] } ], "routing_rule": null } ``` ``` -------------------------------- ### Resource nexus_blobstore_file Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/resources/blobstore_file.md Use this resource to create a Nexus file blobstore. ```APIDOC ## Resource nexus_blobstore_file Use this resource to create a Nexus file blobstore. ### Parameters #### Required - **name** (String) - Blobstore name #### Optional - **path** (String) - The path to the blobstore contents. This can be an absolute path to anywhere on the system nxrm has access to or it can be a path relative to the sonatype-work directory - **soft_quota** (Block List, Max: 1) - Soft quota of the blobstore (see [below for nested schema](#nestedblock--soft_quota)) ### Read-Only - **available_space_in_bytes** (Number) - Available space in Bytes - **blob_count** (Number) - Count of blobs - **id** (String) - Used to identify resource at nexus - **total_size_in_bytes** (Number) - The total size of the blobstore in Bytes ### Nested Schema for `soft_quota` #### Required - **limit** (Number) - The limit in Bytes. Minimum value is 1000000 - **type** (String) - The type to use such as spaceRemainingQuota, or spaceUsedQuota ### Example Usage ```terraform resource "nexus_blobstore_file" "file" { name = "blobstore-file" path = "/nexus-data/blobstore-file" soft_quota { limit = 1024000000 type = "spaceRemainingQuota" } } ``` ### Import Import is supported using the following syntax: ```shell # import using the name of blobstore terraform import nexus_blobstore_file.file blobstore-file ``` ``` -------------------------------- ### Data Source nexus_repository_helm_proxy Source: https://github.com/datadrivers/terraform-provider-nexus/blob/main/docs/data-sources/repository_helm_proxy.md Use this data source to get an existing helm proxy repository. ```APIDOC ## Data Source nexus_repository_helm_proxy ### Description Use this data source to get an existing helm proxy repository. ### Method GET ### Endpoint /api/v1/repositories/{repository_name} ### Parameters #### Path Parameters - **repository_name** (String) - Required - The name of the helm proxy repository. ### Response #### Success Response (200) - **name** (String) - A unique identifier for this repository - **cleanup** (List of Object) - Cleanup policies - **policy_names** (Set of String) - Names of the cleanup policies. - **http_client** (List of Object) - HTTP Client configuration for proxy repositories - **authentication** (List of Object) - Authentication configuration - **ntlm_domain** (String) - NTLM domain. - **ntlm_host** (String) - NTLM host. - **password** (String) - Password for authentication. - **preemptive** (Boolean) - Whether to use preemptive authentication. - **type** (String) - Type of authentication (e.g., basic, ntlm). - **username** (String) - Username for authentication. - **auto_block** (Boolean) - Whether to automatically block the connection on errors. - **blocked** (Boolean) - Whether the connection is blocked. - **connection** (List of Object) - Connection settings - **enable_circular_redirects** (Boolean) - Whether to enable circular redirects. - **enable_cookies** (Boolean) - Whether to enable cookies. - **retries** (Number) - Number of retries for the connection. - **timeout** (Number) - Connection timeout in seconds. - **use_trust_store** (Boolean) - Whether to use the trust store. - **user_agent_suffix** (String) - Suffix for the User-Agent header. - **id** (String) - Used to identify data source at nexus - **negative_cache** (List of Object) - Configuration of the negative cache handling - **enabled** (Boolean) - Whether negative caching is enabled. - **ttl** (Number) - Time-to-live for negative cache entries in seconds. - **online** (Boolean) - Whether this repository accepts incoming requests. - **proxy** (List of Object) - Configuration for the proxy repository - **content_max_age** (Number) - Maximum age for content in the cache in seconds. - **metadata_max_age** (Number) - Maximum age for metadata in the cache in seconds. - **remote_url** (String) - The URL of the remote repository. - **routing_rule** (String) - The name of the routing rule assigned to this repository. - **storage** (List of Object) - The storage configuration of the repository - **blob_store_name** (String) - The name of the blob store. - **strict_content_type_validation** (Boolean) - Whether to enforce strict content type validation. ### Request Example ```terraform data "nexus_repository_helm_proxy" "kubernetes_charts" { name = "kubernetes-charts" } ``` ### Response Example ```json { "name": "kubernetes-charts", "cleanup": { "policy_names": ["daily-cleanup"] }, "http_client": { "authentication": { "type": "basic", "username": "admin" }, "auto_block": false, "blocked": false, "connection": { "timeout": 30, "retries": 3 } }, "id": "helm-proxy-kubernetes-charts", "negative_cache": { "enabled": true, "ttl": 1440 }, "online": true, "proxy": { "remote_url": "https://charts.example.com/", "content_max_age": 14400, "metadata_max_age": 14400 }, "routing_rule": "default", "storage": { "blob_store_name": "default", "strict_content_type_validation": false } } ``` ```