@@ -8,58 +8,59 @@ The `portainer_registry` resource allows you to register container registries in
88### Quay.io Registry
99``` hcl
1010resource "portainer_registry" "quay" {
11- name = "Quay"
12- url = "quay.io"
13- type = 1
14- username = "quay_user"
15- password = "quay_password"
11+ name = "Quay"
12+ url = "quay.io"
13+ type = 1
14+ authentication = true
15+ username = "quay-user"
16+ password = "quay-token"
17+ quay_use_organisation = true # optional
18+ quay_organisation_name = "myorg" # optional, but if define/exist quay_use_organisation you must define also value fot this variable
1619}
1720```
1821
1922### Azure Registry
2023``` hcl
2124resource "portainer_registry" "azure" {
2225 name = "Azure"
23- url = "azurecr.io/myregistry"
24- base_url = "azurecr.io"
26+ url = "myproject.azurecr.io"
2527 type = 2
26- username = "azure_user "
27- password = "azure_password "
28+ username = "azure-user "
29+ password = "azure-password "
2830}
2931```
3032
31- ### Anonymous Custom Registry
33+ ### Custom Registry
34+ - ** Anonymus:**
3235``` hcl
3336resource "portainer_registry" "custom" {
3437 name = "Custom Registry"
35- url = "registry.example.com:5000/feed"
36- base_url = "registry.example.com:5000"
38+ url = "your-registry.example.com"
3739 type = 3
3840 authentication = false
3941}
4042```
4143
42- ### Custom Registry with Auth
44+ - ** Authentication: **
4345``` hcl
4446resource "portainer_registry" "custom_auth" {
45- name = "My Registry"
46- url = "registry.example.com/feed"
47- base_url = "registry.example.com"
47+ name = "Custom Registry"
48+ url = "your-registry.example.com"
4849 type = 3
4950 authentication = true
50- username = "admin "
51- password = "supersecret "
51+ username = "custom-registry-user "
52+ password = "custom-registry-password "
5253}
5354```
5455
5556### GitLab Registry
5657``` hcl
5758resource "portainer_registry" "gitlab" {
5859 name = "GitLab Registry"
59- url = "registry.gitlab.com/group/project "
60+ url = "registry.gitlab.com"
6061 type = 4
61- username = "gitlab_user "
62- password = "gitlab_token "
62+ username = "gitlab-user "
63+ password = "gitlab-acces-token "
6364 instance_url = "https://gitlab.com"
6465}
6566```
@@ -68,11 +69,11 @@ resource "portainer_registry" "gitlab" {
6869``` hcl
6970resource "portainer_registry" "proget" {
7071 name = "ProGet"
71- url = "proget.myorg.net/feed "
72- base_url = "proget.myorg.net "
72+ url = "proget.example.com/example-registry "
73+ base_url = "proget.example.com "
7374 type = 5
74- username = "admin "
75- password = "password"
75+ username = "proget-user "
76+ password = "proget- password"
7677}
7778```
7879
@@ -82,24 +83,62 @@ resource "portainer_registry" "dockerhub" {
8283 name = "DockerHub"
8384 type = 6
8485 url = "docker.io"
85- username = "docker_user "
86- password = "docker_token "
86+ username = "docker-user "
87+ password = "docker-access-token "
8788}
8889```
8990
9091### AWS ECR
92+ - ** Anonymus:**
93+ ``` hcl
94+ resource "portainer_registry" "ecr" {
95+ name = "AWS ECR"
96+ url = "123456789.dkr.ecr.us-east-1.amazonaws.com"
97+ type = 7
98+ authentication = false
99+ }
100+ ```
101+
102+ - ** Authentication:**
91103``` hcl
92104resource "portainer_registry" "ecr" {
93105 name = "AWS ECR"
94106 url = "123456789.dkr.ecr.us-east-1.amazonaws.com"
95107 type = 7
96108 authentication = true
97- username = "aws_access_key "
98- password = "aws_secret_key "
109+ username = "aws-access-key "
110+ password = "aws-secret-key "
99111 aws_region = "us-east-1"
100112}
101113```
102114
115+ ### GitHub
116+ - ** GitHub type registry use only on BE Poertainer GUI:**
117+ ``` hcl
118+ resource "portainer_registry" "github" {
119+ name = "GitHub Registry"
120+ type = 8
121+ url = "ghcr.io"
122+ authentication = true
123+ username = "your-github-username"
124+ password = "your-github-access-token"
125+ github_use_organisation = true # optional
126+ github_organisation_name = "myorg" # optional, but if define/exist github_use_organisation you must define also value fot this variable
127+ }
128+ ```
129+
130+ - ** Add GitHub registry by custom type on CE Portainer GUI** , but without options define ` github_use_organisation ` and ` github_organisation_name ` :
131+ ``` hcl
132+ resource "portainer_registry" "github_custom" {
133+ name = "GitHub Registry"
134+ url = "ghcr.io"
135+ type = 3
136+ authentication = true
137+ username = "your-github-username"
138+ password = "your-github-access-token"
139+ }
140+ ```
141+
103142## Lifecycle & Behavior
104143Registries are updated if any of the arguments change.
105144- To delete a registry created via Terraform, simply run:
@@ -113,18 +152,21 @@ terraform apply
113152```
114153
115154## Arguments Reference
116- | Name | Type | Required | Description |
117- | ----------------| ---------| -------------------------------| -----------------------------------------------------------------------------|
118- | ` name ` | string | ✅ yes | Name of the registry |
119- | ` url ` | string | ✅ yes | Registry access URL (e.g., ` registry.example.com:5000 ` ) |
120- | ` base_url ` | string | 🚫 optional | Base URL (for some types like Azure, Custom, ProGet) |
121- | ` type ` | int | ✅ yes | Registry type:<br >1 = Quay.io<br >2 = Azure<br >3 = Custom<br >4 = GitLab<br >5 = ProGet<br >6 = Docker Hub<br >7 = AWS ECR |
122- | ` authentication ` | bool | 🚫 optional (default ` false ` ) | Whether the registry requires authentication (Custom, ECR only) |
123- | ` username ` | string | 🚫 optional | Username for authentication (if applicable) |
124- | ` password ` | string | 🚫 optional | Password or token for authentication (if applicable) |
125- | ` instance_url ` | string | 🚫 optional | GitLab instance URL (for type = 4) |
126- | ` aws_region ` | string | 🚫 optional | AWS Region (for ECR, type = 7) |
127-
155+ | Name | Type | Required | Description |
156+ | -------------------------- | ------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
157+ | ` name ` | string | ✅ yes | Name of the registry |
158+ | ` url ` | string | ✅ yes | Registry access URL (e.g., ` registry.example.com:5000 ` ) |
159+ | ` base_url ` | string | 🚫 optional | Base URL (for some types like Azure, Custom, ProGet) |
160+ | ` type ` | int | ✅ yes | Registry type:<br >1 = Quay.io<br >2 = Azure<br >3 = Custom<br >4 = GitLab<br >5 = ProGet<br >6 = Docker Hub<br >7 = AWS ECR<br >8 = GitHub Container Registry |
161+ | ` authentication ` | bool | 🚫 optional (default ` false ` ) | Whether the registry requires authentication (Custom, ECR, GitHub only) |
162+ | ` username ` | string | 🚫 optional | Username for authentication (if applicable) - must be define if ` authentication = true ` |
163+ | ` password ` | string | 🚫 optional | Password or token for authentication (if applicable)- must be define if ` authentication = true ` |
164+ | ` instance_url ` | string | 🚫 optional | GitLab instance URL (for type = 4) |
165+ | ` aws_region ` | string | 🚫 optional | AWS Region (for ECR, type = 7) |
166+ | ` github_use_organisation ` | bool | 🚫 optional (default ` false ` ) | Whether to use a GitHub organisation scope (for type = 8, GitHub registry) |
167+ | ` github_organisation_name ` | string | 🚫 optional | Name of the GitHub organisation (for type = 8, GitHub registry) - must be define if ` github_use_organisation = true ` |
168+ | ` quay_use_organisation ` | bool | 🚫 optional (default ` false ` ) | Whether to use an organisation namespace for Quay.io (for type = 1) |
169+ | ` quay_organisation_name ` | string | 🚫 optional | Name of the Quay.io organisation (for type = 1) - must be define if ` quay_use_organisation = true ` |
128170
129171## Attributes Reference
130172
0 commit comments