Skip to content

Commit

Permalink
Merge pull request #241 from datadrivers/feat/235
Browse files Browse the repository at this point in the history
feat(repository): Add resource and data source for maven proxy repo
  • Loading branch information
anmoel committed Jun 13, 2022
2 parents 67a5a99 + d4c7c25 commit 6f14680
Show file tree
Hide file tree
Showing 25 changed files with 1,162 additions and 176 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/repository_apt_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data "nexus_repository_apt_proxy" "bionic_proxy" {
- `cleanup` (List of Object) Cleanup policies (see [below for nested schema](#nestedatt--cleanup))
- `distribution` (String) Distribution to fetch
- `flat` (Boolean) Distribution to fetch
- `http_client` (List of Object) HTTP Client configuration for proxy repositories. Required for docker proxy repositories. (see [below for nested schema](#nestedatt--http_client))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedatt--http_client))
- `id` (String) Used to identify data source at nexus
- `negative_cache` (List of Object) Configuration of the negative cache handling (see [below for nested schema](#nestedatt--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/repository_docker_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data "nexus_repository_docker_proxy" "dockerhub" {
- `cleanup` (List of Object) Cleanup policies (see [below for nested schema](#nestedatt--cleanup))
- `docker` (List of Object) docker contains the configuration of the docker repository (see [below for nested schema](#nestedatt--docker))
- `docker_proxy` (List of Object) docker_proxy contains the configuration of the docker index (see [below for nested schema](#nestedatt--docker_proxy))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories. Required for docker proxy repositories. (see [below for nested schema](#nestedatt--http_client))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedatt--http_client))
- `id` (String) Used to identify data source at nexus
- `negative_cache` (List of Object) Configuration of the negative cache handling (see [below for nested schema](#nestedatt--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
Expand Down
114 changes: 114 additions & 0 deletions docs/data-sources/repository_maven_proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
page_title: "Data Source nexus_repository_maven_proxy"
subcategory: "Repository"
description: |-
Use this data source to get an existing maven proxy repository.
---
# Data Source nexus_repository_maven_proxy
Use this data source to get an existing maven proxy repository.
## Example Usage
```terraform
data "nexus_repository_maven_proxy" "maven_central" {
name = "maven-central"
}
```
<!-- schema generated by tfplugindocs -->
## 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))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedatt--http_client))
- `id` (String) Used to identify data source at nexus
- `maven` (List of Object) Maven contains additional data of maven repository (see [below for nested schema](#nestedatt--maven))
- `negative_cache` (List of Object) Configuration of the negative cache handling (see [below for nested schema](#nestedatt--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
- `proxy` (List of Object) Configuration for the proxy repository (see [below for nested schema](#nestedatt--proxy))
- `routing_rule` (String) The name of the routing rule assigned to this repository
- `storage` (List of Object) The storage configuration of the repository (see [below for nested schema](#nestedatt--storage))

<a id="nestedatt--cleanup"></a>
### Nested Schema for `cleanup`

Read-Only:

- `policy_names` (Set of String)


<a id="nestedatt--http_client"></a>
### Nested Schema for `http_client`

Read-Only:

- `authentication` (List of Object) (see [below for nested schema](#nestedobjatt--http_client--authentication))
- `auto_block` (Boolean)
- `blocked` (Boolean)
- `connection` (List of Object) (see [below for nested schema](#nestedobjatt--http_client--connection))

<a id="nestedobjatt--http_client--authentication"></a>
### Nested Schema for `http_client.authentication`

Read-Only:

- `ntlm_domain` (String)
- `ntlm_host` (String)
- `password` (String)
- `preemptive` (Boolean)
- `type` (String)
- `username` (String)


<a id="nestedobjatt--http_client--connection"></a>
### Nested Schema for `http_client.connection`

Read-Only:

- `enable_circular_redirects` (Boolean)
- `enable_cookies` (Boolean)
- `retries` (Number)
- `timeout` (Number)
- `use_trust_store` (Boolean)
- `user_agent_suffix` (String)



<a id="nestedatt--maven"></a>
### Nested Schema for `maven`

Read-Only:

- `content_disposition` (String)
- `layout_policy` (String)
- `version_policy` (String)


<a id="nestedatt--negative_cache"></a>
### Nested Schema for `negative_cache`

Read-Only:

- `enabled` (Boolean)
- `ttl` (Number)


<a id="nestedatt--proxy"></a>
### Nested Schema for `proxy`

Read-Only:

- `content_max_age` (Number)
- `metadata_max_age` (Number)
- `remote_url` (String)


<a id="nestedatt--storage"></a>
### Nested Schema for `storage`

Read-Only:

- `blob_store_name` (String)
- `strict_content_type_validation` (Boolean)
2 changes: 1 addition & 1 deletion docs/data-sources/repository_npm_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "nexus_repository_npm_proxy" "npmjs" {
### Read-Only

- `cleanup` (List of Object) Cleanup policies (see [below for nested schema](#nestedatt--cleanup))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories. Required for docker proxy repositories. (see [below for nested schema](#nestedatt--http_client))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedatt--http_client))
- `id` (String) Used to identify data source at nexus
- `negative_cache` (List of Object) Configuration of the negative cache handling (see [below for nested schema](#nestedatt--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/repository_yum_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data "nexus_repository_yum_proxy" "centos" {
### Read-Only

- `cleanup` (List of Object) Cleanup policies (see [below for nested schema](#nestedatt--cleanup))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories. Required for docker proxy repositories. (see [below for nested schema](#nestedatt--http_client))
- `http_client` (List of Object) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedatt--http_client))
- `id` (String) Used to identify data source at nexus
- `negative_cache` (List of Object) Configuration of the negative cache handling (see [below for nested schema](#nestedatt--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/repository_apt_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ resource "nexus_repository_apt_proxy" "bionic_proxy" {
### Optional

- `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories. Required for docker proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
- `routing_rule` (String) The name of the routing rule assigned to this repository
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/repository_docker_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "nexus_repository_docker_proxy" "dockerhub" {
### Optional

- `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories. Required for docker proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
- `routing_rule` (String) The name of the routing rule assigned to this repository
Expand Down
162 changes: 162 additions & 0 deletions docs/resources/repository_maven_proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
---
page_title: "Resource nexus_repository_maven_proxy"
subcategory: "Repository"
description: |-
Use this resource to create a maven proxy repository.
---
# Resource nexus_repository_maven_proxy
Use this resource to create a maven proxy repository.
## Example Usage
```terraform
resource "nexus_repository_maven_proxy" "maven_central" {
name = "maven-central-repo1"
online = true
storage {
blob_store_name = "default"
strict_content_type_validation = true
}
proxy {
remote_url = "https://repo1.maven.org/maven2/"
content_max_age = 1440
metadata_max_age = 1440
}
negative_cache {
enabled = true
time_to_live = 1440
}
http_client {
blocked = false
auto_block = true
}
maven {
version_policy = "RELEASE"
layout_policy = "PERMISSIVE"
}
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `maven` (Block List, Min: 1, Max: 1) Maven contains additional data of maven repository (see [below for nested schema](#nestedblock--maven))
- `name` (String) A unique identifier for this repository
- `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy))
- `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage))

### Optional

- `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
- `routing_rule` (String) The name of the routing rule assigned to this repository

### Read-Only

- `id` (String) Used to identify resource at nexus

<a id="nestedblock--maven"></a>
### Nested Schema for `maven`

Required:

- `layout_policy` (String) Validate that all paths are maven artifact or metadata paths. Possible Value: `STRICT` or `PERMISSIVE`
- `version_policy` (String) What type of artifacts does this repository store? Possible Value: `RELEASE`, `SNAPSHOT` or `MIXED`

Optional:

- `content_disposition` (String) Add Content-Disposition header as 'Attachment' to disable some content from being inline in a browse. Possible Value: `INLINE` or `ATTACHMENT`


<a id="nestedblock--proxy"></a>
### Nested Schema for `proxy`

Required:

- `remote_url` (String) Location of the remote repository being proxied

Optional:

- `content_max_age` (Number) How long (in minutes) to cache artifacts before rechecking the remote repository
- `metadata_max_age` (Number) How long (in minutes) to cache metadata before rechecking the remote repository.


<a id="nestedblock--storage"></a>
### Nested Schema for `storage`

Required:

- `blob_store_name` (String) Blob store used to store repository contents

Optional:

- `strict_content_type_validation` (Boolean) Whether to validate uploaded content's MIME type appropriate for the repository format


<a id="nestedblock--cleanup"></a>
### Nested Schema for `cleanup`

Optional:

- `policy_names` (Set of String) List of policy names


<a id="nestedblock--http_client"></a>
### Nested Schema for `http_client`

Optional:

- `authentication` (Block List, Max: 1) Authentication configuration of the HTTP client (see [below for nested schema](#nestedblock--http_client--authentication))
- `auto_block` (Boolean) Whether to auto-block outbound connections if remote peer is detected as unreachable/unresponsive
- `blocked` (Boolean) Whether to block outbound connections on the repository
- `connection` (Block List, Max: 1) Connection configuration of the HTTP client (see [below for nested schema](#nestedblock--http_client--connection))

<a id="nestedblock--http_client--authentication"></a>
### Nested Schema for `http_client.authentication`

Required:

- `type` (String) Authentication type. Possible values: `ntlm` or `username`

Optional:

- `ntlm_domain` (String) The ntlm domain to connect
- `ntlm_host` (String) The ntlm host to connect
- `password` (String, Sensitive) The password used by the proxy repository
- `preemptive` (Boolean) Whether to use pre-emptive authentication. Use with caution. Defaults to false.
- `username` (String) The username used by the proxy repository


<a id="nestedblock--http_client--connection"></a>
### Nested Schema for `http_client.connection`

Optional:

- `enable_circular_redirects` (Boolean) Whether to enable redirects to the same location (may be required by some servers)
- `enable_cookies` (Boolean) Whether to allow cookies to be stored and used
- `retries` (Number) Total retries if the initial connection attempt suffers a timeout
- `timeout` (Number) Seconds to wait for activity before stopping and retrying the connection
- `use_trust_store` (Boolean) Use certificates stored in the Nexus Repository Manager truststore to connect to external systems
- `user_agent_suffix` (String) Custom fragment to append to User-Agent header in HTTP requests



<a id="nestedblock--negative_cache"></a>
### Nested Schema for `negative_cache`

Optional:

- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository
- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes)
## Import
Import is supported using the following syntax:
```shell
# import using the name of repository
terraform import nexus_repository_maven_proxy.maven_central maven-central
```
2 changes: 1 addition & 1 deletion docs/resources/repository_npm_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "nexus_repository_npm_proxy" "npmjs" {
### Optional

- `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories. Required for docker proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
- `remove_non_cataloged` (Boolean) Remove non-catalogued versions from the npm package metadata.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/repository_yum_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "nexus_repository_yum_proxy" "centos" {
### Optional

- `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories. Required for docker proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `http_client` (Block List, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client))
- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache))
- `online` (Boolean) Whether this repository accepts incoming requests
- `routing_rule` (String) The name of the routing rule assigned to this repository
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "nexus_repository_maven_proxy" "maven_central" {
name = "maven-central"
}
2 changes: 2 additions & 0 deletions examples/resources/nexus_repository_maven_proxy/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# import using the name of repository
terraform import nexus_repository_maven_proxy.maven_central maven-central
30 changes: 30 additions & 0 deletions examples/resources/nexus_repository_maven_proxy/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "nexus_repository_maven_proxy" "maven_central" {
name = "maven-central-repo1"
online = true

storage {
blob_store_name = "default"
strict_content_type_validation = true
}

proxy {
remote_url = "https://repo1.maven.org/maven2/"
content_max_age = 1440
metadata_max_age = 1440
}

negative_cache {
enabled = true
time_to_live = 1440
}

http_client {
blocked = false
auto_block = true
}

maven {
version_policy = "RELEASE"
layout_policy = "PERMISSIVE"
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/client9/misspell v0.3.4
github.com/datadrivers/go-nexus-client v1.4.0
github.com/datadrivers/go-nexus-client v1.4.1
github.com/datadrivers/terraform-plugin-docs v0.9.0-1
github.com/golangci/golangci-lint v1.46.2
github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0
Expand Down

0 comments on commit 6f14680

Please sign in to comment.