Skip to content

Latest commit

 

History

History
106 lines (84 loc) · 3.66 KB

replication.md

File metadata and controls

106 lines (84 loc) · 3.66 KB
page_title subcategory description
harbor_replication Resource - terraform-provider-harbor

harbor_replication (Resource)

Example Usage

resource "harbor_registry" "main" {
  provider_name = "docker-hub"
  name          = "test_docker_harbor"
  endpoint_url  = "https://hub.docker.com"

}

resource "harbor_replication" "push" {
  name        = "test_push"
  action      = "push"
  registry_id = harbor_registry.main.registry_id
}

resource "harbor_replication" "alpine" {
  name        = "alpine"
  action      = "pull"
  registry_id = harbor_registry.main.registry_id
  schedule = "0 0/15 * * * *"
  filters {
    name = "library/alpine"
  }
  filters {
    tag = "3.*.*"
  }
  filters {
    resource = "artifact"
  }
  filters {
    labels = ["qa"]
  }
}

resource "harbor_replication" "alpine" {
  name        = "alpine"
  action      = "push"
  registry_id = harbor_registry.main.registry_id
  schedule = "event_based"
  filters {
    name = "library/alpine"
  }
  filters {
    tag = "3.*.*"
  }
}

Schema

Required

  • action (String)
  • name (String) The name of the replication.
  • registry_id (Number) The registry ID of the Registry Endpoint.

Optional

  • deletion (Boolean) Specify whether to delete the remote resources when locally deleted. (Default: false)
  • description (String) Description of the replication policy.
  • dest_namespace (String) Specify the destination namespace. if empty, the resource will be put under the same namespace as the source.
  • dest_namespace_replace (Number) Specify the destination namespace flattening policy. Integers from -1 to 3 are valid values in the harbor API. A value of -1 will 'Flatten All Levels', 0 means 'No Flattening', 1 'Flatten 1 Level', 2 'Flatten 2 Levels', 3 'Flatten 3 Levels' (Default: -1, see Replication Rules for more details)
  • copy_by_chunk (Boolean) Specify whether to enable the artifact blobs copied by chunks. (Default: false)
  • enabled (Boolean) Specify whether the replication is enabled. (Default: true)
  • execute_on_changed (Boolean) Specify whether to execute the replication rule if new or modified. (Default: false)
  • filters (Block Set) (see below for nested schema)
  • override (Boolean) Specify whether to override the resources at the destination if a resources with the same name exist. (Default: true)
  • schedule (String) The scheduled time of when the container register will be push / pull. In cron base format. Hourly "0 0 * * * *", Daily "0 0 0 * * *", Monthly "0 0 0 * * 0". Can be one of the following: event_based, manual, cron format (Default: manual)
  • speed (Number) The Maximum network bandwidth in Kbps for each execution. Default is -1 (unlimited).

Read-Only

  • id (String) The ID of this resource.
  • replication_policy_id (Number)

Nested Schema for filters

Optional:

  • decoration (String) Matches or excludes the result. Can be one of the following. matches, excludes
  • labels (List of String) Filter on the resource according to labels.
  • name (String) Filter on the name of the resource.
  • resource (String) Filter on the resource type. Can be one of the following types. chart, artifact
  • tag (String) Filter on the tag/version of the resource.

Import

Import is supported using the following syntax with the replication id:

terraform import harbor_replication.main /replication/policies/1