Skip to content

Commit

Permalink
test harbor intranet config
Browse files Browse the repository at this point in the history
  • Loading branch information
o-orand committed Apr 27, 2022
1 parent 97e1e9a commit ed18908
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2022 Olivier Orand

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
70 changes: 70 additions & 0 deletions harbor-intranet-registries.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
resource "harbor_registry" "harbor_internet" {
provider_name = "harbor"
name = "internet"
endpoint_url = format("https://%s.%s",var.harbor_internet_hostname,var.ops_domain)
}

resource "harbor_registry" "dockerhub_mirror" {
provider_name = "docker-registry"
name = "dockerhub"
endpoint_url = var.dockerhub_mirror_url
}

resource "harbor_registry" "quayio_mirror" {
provider_name = "docker-registry"
name = "quayio"
endpoint_url = var.quayio_mirror_url
}

resource "harbor_registry" "jcr_mirror" {
provider_name = "docker-registry"
name = "jcr"
endpoint_url = format("https://%s.%s",var.docker_jcr_hostname,var.ops_domain)
}

resource "harbor_project" "harbor_internet" {
name = "internet"
registry_id = harbor_registry.harbor_internet.registry_id
public = true
}

resource "harbor_project" "dockerhub_mirror" {
name = "dockerhub"
registry_id = harbor_registry.dockerhub_mirror.registry_id
public = true
}

resource "harbor_project" "quayio_mirror" {
name = "quayio"
registry_id = harbor_registry.quayio_mirror.registry_id
public = true
}

resource "harbor_project" "jcr_mirror" {
name = "jcr"
registry_id = harbor_registry.jcr_mirror.registry_id
public = true
}


variable "harbor_internet_hostname" {
type = string
description = "Harbor internet hostname"
default = "harbor-core"
}

variable "dockerhub_mirror_url" {
type = string
description = "Docker Hub mirror url"
}

variable "quayio_mirror_url" {
type = string
description = "Quay.io mirror url"
}

variable "docker_jcr_hostname" {
type = string
description = "Paas templates JCR hostname"
default = "docker.jcr-k8s"
}
36 changes: 36 additions & 0 deletions harbor-provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
terraform {
required_providers {
harbor = {
source = "BESTSELLER/harbor"
version = "3.5.0"
}
}
}

provider "harbor" {
url = format("https://%s.%s",var.harbor_intranet_hostname,var.ops_domain)
username = var.harbor_intranet_username
password = var.harbor_intranet_password
}

variable "harbor_intranet_hostname" {
type = string
description = "Harbor intranet hostname"
default = "harbor-intra-core"
}

variable "harbor_intranet_username" {
type = string
description = "Harbor intranet username"
}

variable "harbor_intranet_password" {
type = string
description = "Harbor intranet password"
sensitive = true
}

variable "ops_domain" {
type = string
description = "Paas Templates OPS domain"
}

0 comments on commit ed18908

Please sign in to comment.