Playing locally with TF and Nexus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Providers declaration | |
terraform { | |
required_providers { | |
nexus = { | |
source = "datadrivers/nexus" | |
version = "1.10.5" | |
} | |
} | |
} | |
## Access configuration | |
provider "nexus" { | |
insecure = true | |
url = "http://localhost:8081" | |
username = "admin" | |
password = "some-complex-pass-here" | |
} | |
## Users configuration | |
resource "nexus_user" "admin" { | |
userid = "sa01" | |
firstname = "01" | |
lastname = "Service Account" | |
email = "sa01@example.com" | |
password = "some-complex-pass-here" | |
roles = ["nx-admin"] | |
status = "active" | |
} | |
## Define a blob store | |
resource "nexus_blobstore" "bs01" { | |
name = "blobstore-file-01" | |
type = "File" | |
path = "/nexus-data/blobstore-file-01" | |
soft_quota { | |
limit = 1024 | |
type = "spaceRemainingQuota" | |
} | |
} | |
## Custom role creation | |
resource "nexus_role" "nx-docker-deploy" { | |
description = "Docker deployment role" | |
name = "nx-docker-deploy" | |
privileges = [ | |
"nx-repository-view-docker-*-*", | |
] | |
roleid = "docker-deploy" | |
} | |
## Maven repository | |
resource "nexus_repository" "main-releases" { | |
name = "main-releases" | |
format = "maven2" | |
type = "hosted" | |
online = true | |
storage { | |
blob_store_name = "default" | |
strict_content_type_validation = true | |
write_policy = "ALLOW_ONCE" | |
} | |
maven { | |
version_policy = "MIXED" | |
layout_policy = "STRICT" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment