@@ -184,18 +184,56 @@ resource "harbor_project" "mybinder-builds" {
184184 name = " mybinder-builds"
185185}
186186
187- resource "harbor_robot_account" "builder" {
188- name = " builder"
189- description = " BinderHub builder: push new user images"
190- project_id = harbor_project. mybinder-builds . id
191- actions = [" push" , " pull" ]
187+ # we should be able to use robot accounts
188+ # after an update to Harbor and the harbor provider
189+ # resource "harbor_robot_account" "builder" {
190+ # name = "builder"
191+ # description = "BinderHub builder: push new user images"
192+ # project_id = harbor_project.mybinder-builds.id
193+ # actions = ["push", "pull"]
194+ # }
195+ #
196+ # resource "harbor_robot_account" "user-puller" {
197+ # name = "user-puller"
198+ # description = "Pull access to user images"
199+ # project_id = harbor_project.mybinder-builds.id
200+ # actions = ["pull"]
201+ # }
202+
203+ resource "random_password" "builder" {
204+ length = 16
205+ special = true
206+ }
207+
208+ resource "random_password" "user-puller" {
209+ length = 16
210+ special = true
211+ }
212+
213+ resource "harbor_user" "builder" {
214+ username = " mybinder-builder"
215+ password = random_password. builder . result
216+ full_name = " MyBinder Builder"
217+ 218+ }
219+
220+ resource "harbor_user" "user-puller" {
221+ username = " mybinder-puller"
222+ password = random_password. user-puller . result
223+ full_name = " MyBinder Puller"
224+ 225+ }
226+
227+ resource "harbor_project_member_user" "builder" {
228+ project_id = harbor_project. mybinder-builds . id
229+ user_name = harbor_user. builder . username
230+ role = " developer"
192231}
193232
194- resource "harbor_robot_account" "user-puller" {
195- name = " user-puller"
196- description = " Pull access to user images"
197- project_id = harbor_project. mybinder-builds . id
198- actions = [" pull" ]
233+ resource "harbor_project_member_user" "user-puller" {
234+ project_id = harbor_project. mybinder-builds . id
235+ user_name = harbor_user. user-puller . username
236+ role = " limitedguest"
199237}
200238
201239# retention policies created by hand
@@ -237,11 +275,11 @@ output "registry_admin_password" {
237275}
238276
239277output "registry_builder_token" {
240- value = harbor_robot_account . builder . token
278+ value = harbor_user . builder . password
241279 sensitive = true
242280}
243281
244282output "registry_user_puller_token" {
245- value = harbor_robot_account . user-puller . token
283+ value = harbor_user . user-puller . password
246284 sensitive = true
247285}
0 commit comments