Skip to content

Instantly share code, notes, and snippets.

@fedir
Created January 3, 2021 22:44
Show Gist options
  • Save fedir/b325a9c84150d76e1abc8a2926a0538c to your computer and use it in GitHub Desktop.
Save fedir/b325a9c84150d76e1abc8a2926a0538c to your computer and use it in GitHub Desktop.
Playing locally with TF and Nexus
## 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