{"id":1346,"date":"2024-10-17T14:22:47","date_gmt":"2024-10-17T14:22:47","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2024\/10\/17\/new-docker-terraform-provider-automate-secure-and-scale-with-ease\/"},"modified":"2024-10-17T14:22:47","modified_gmt":"2024-10-17T14:22:47","slug":"new-docker-terraform-provider-automate-secure-and-scale-with-ease","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2024\/10\/17\/new-docker-terraform-provider-automate-secure-and-scale-with-ease\/","title":{"rendered":"New Docker Terraform Provider: Automate, Secure, and Scale with Ease"},"content":{"rendered":"<p>We\u2019re excited to announce the launch of the <a href=\"https:\/\/github.com\/docker\/terraform-provider-docker\" target=\"_blank\" rel=\"noopener\">Docker Terraform Provider<\/a>, designed to help users and organizations automate and securely manage their Docker-hosted resources. This includes repositories, teams, organization settings, and more, all using Terraform\u2019s infrastructure-as-code approach. This provider brings a unified, scalable, and secure solution for managing Docker resources in an automated fashion \u2014 whether you\u2019re managing a single repository or a large-scale organization.<\/p>\n<h2 class=\"wp-block-heading\">A new way of working with Docker Hub<\/h2>\n<p>The Docker Terraform Provider introduces a new way of working with <a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener\">Docker Hub<\/a>, enabling infrastructure-as-code best practices that are already widely adopted across cloud-native environments. By integrating Docker Hub with Terraform, organizations can streamline resource management, improve security, and collaborate more effectively, all while ensuring Docker resources remain in sync with other infrastructure components.<\/p>\n<h3 class=\"wp-block-heading\">The Problem<\/h3>\n<p>Managing Docker Hub resources manually can become cumbersome and prone to errors, especially as teams grow and projects scale. Maintaining configurations can lead to inconsistencies, reduced security, and a lack of collaboration between teams without a streamlined, version-controlled system. The Docker Terraform Provider solves this by allowing you to manage Docker Hub resources in the same way you manage your other cloud resources, ensuring consistency, auditability, and automation across the board.<\/p>\n<h3 class=\"wp-block-heading\">The solution<\/h3>\n<p>The Docker Terraform Provider offers:<\/p>\n<p><strong>Unified management<\/strong>: With this provider, you can manage Docker repositories, teams, users, and organizations in a consistent workflow, using the same code and structure across environments.<\/p>\n<p><strong>Version control<\/strong>: Changes to Docker Hub resources are captured in your Terraform configuration, providing a version-controlled, auditable way to manage your Docker infrastructure.<\/p>\n<p><strong>Collaboration and automation<\/strong>: Teams can now collaborate seamlessly, automating the provisioning and management of Docker Hub resources with Terraform, enhancing productivity and ensuring best practices are followed.<\/p>\n<p><strong>Scalability<\/strong>: Whether you\u2019re managing a few repositories or an entire organization, this provider scales effortlessly to meet your needs.<\/p>\n<h4 class=\"wp-block-heading\">Example<\/h4>\n<p>At Docker, even we faced challenges managing our Docker Hub resources, especially when adding repositories without owner permissions \u2014 it was a frustrating, manual process. With the Terraform provider, anyone in the company can create a new repository without having elevated Docker Hub permissions. All levels of employees are now empowered to write code rather than track down coworkers. This streamlines developer workflows with familiar tooling and reduces employee permissions. Security and developers are happy!<\/p>\n<p>Here\u2019s an example where we are managing a repository, an org team, the permissions for the created repo, and a PAT token:<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\nterraform {<br \/>\n  required_providers {<br \/>\n    docker = {<br \/>\n      source  = &#8220;docker\/docker&#8221;<br \/>\n      version = &#8220;~&gt; 0.2&#8221;<br \/>\n    }<br \/>\n  }<br \/>\n}\n<p># Initialize provider<br \/>\nprovider &#8220;docker&#8221; {}<\/p>\n<p># Define local variables for customization<br \/>\nlocals {<br \/>\n  namespace        = &#8220;my-docker-namespace&#8221;<br \/>\n  repo_name        = &#8220;my-docker-repo&#8221;<br \/>\n  org_name         = &#8220;my-docker-org&#8221;<br \/>\n  team_name        = &#8220;my-team&#8221;<br \/>\n  my_team_users    = [&#8220;user1&#8221;, &#8220;user2&#8221;]<br \/>\n  token_label      = &#8220;my-pat-token&#8221;<br \/>\n  token_scopes     = [&#8220;repo:read&#8221;, &#8220;repo:write&#8221;]<br \/>\n  permission       = &#8220;admin&#8221;<br \/>\n}<\/p>\n<p># Create repository<br \/>\nresource &#8220;docker_hub_repository&#8221; &#8220;org_hub_repo&#8221; {<br \/>\n  namespace        = local.namespace<br \/>\n  name             = local.repo_name<br \/>\n  description      = &#8220;This is a generic Docker repository.&#8221;<br \/>\n  full_description = &#8220;Full description for the repository.&#8221;<br \/>\n}<\/p>\n<p># Create team<br \/>\nresource &#8220;docker_org_team&#8221; &#8220;team&#8221; {<br \/>\n  org_name         = local.org_name<br \/>\n  team_name        = local.team_name<br \/>\n  team_description = &#8220;Team description goes here.&#8221;<br \/>\n}<\/p>\n<p># Team association<br \/>\nresource &#8220;docker_org_team_member&#8221; &#8220;team_membership&#8221; {<br \/>\n  for_each = toset(local.my_team_users)<\/p>\n<p>  org_name  = local.org_name<br \/>\n  team_name = docker_org_team.team.team_name<br \/>\n  user_name = each.value<br \/>\n}<\/p>\n<p># Create repository team permission<br \/>\nresource &#8220;docker_hub_repository_team_permission&#8221; &#8220;repo_permission&#8221; {<br \/>\n  repo_id    = docker_hub_repository.org_hub_repo.id<br \/>\n  team_id    = docker_org_team.team.id<br \/>\n  permission = local.permission<br \/>\n}<\/p>\n<p># Create access token<br \/>\nresource &#8220;docker_access_token&#8221; &#8220;access_token&#8221; {<br \/>\n  token_label = local.token_label<br \/>\n  scopes      = local.token_scopes<br \/>\n}\n<\/p><\/div>\n<h2 class=\"wp-block-heading\">Future work<\/h2>\n<p>We\u2019re just getting started with the Docker Terraform Provider, and there\u2019s much more to come. Future work will expand support to other products in Docker\u2019s suite, including <a href=\"https:\/\/www.docker.com\/products\/docker-scout\/\" target=\"_blank\" rel=\"noopener\">Docker Scout<\/a>, <a href=\"https:\/\/www.docker.com\/products\/build-cloud\/\" target=\"_blank\" rel=\"noopener\">Docker Build Cloud<\/a>, and <a href=\"https:\/\/testcontainers.com\/cloud\/\" target=\"_blank\" rel=\"noopener\">Testcontainers Cloud<\/a>. Stay tuned as we continue to evolve and enhance the provider with new features and integrations.<\/p>\n<p>For feedback and issue tracking, visit the official<a href=\"https:\/\/github.com\/docker\/terraform-provider-docker\" target=\"_blank\" rel=\"noopener\"> Docker Terraform Provider repository<\/a> or submit feedback via<a href=\"https:\/\/github.com\/docker\/terraform-provider-docker\/issues?q=sort:updated-desc+is:issue+is:open\" target=\"_blank\" rel=\"noopener\"> our issue tracker<\/a>.<\/p>\n<p>We\u2019re confident this new provider will enhance how teams work with Docker Hub, making it easier to manage, secure, and scale their infrastructure while focusing on what matters most \u2014 building great software.<\/p>\n<h3 class=\"wp-block-heading\">Learn more<\/h3>\n<p>Visit the official<a href=\"https:\/\/github.com\/docker\/terraform-provider-docker\" target=\"_blank\" rel=\"noopener\"> Docker Terraform Provider repository<\/a>.<\/p>\n<p>Submit feedback via<a href=\"https:\/\/github.com\/docker\/terraform-provider-docker\/issues?q=sort:updated-desc+is:issue+is:open\" target=\"_blank\" rel=\"noopener\"> our issue tracker<\/a>.<\/p>\n<p>Subscribe to the <a href=\"https:\/\/www.docker.com\/newsletter-subscription\/\" target=\"_blank\" rel=\"noopener\">Docker Newsletter<\/a>.\u00a0<\/p>\n<p>Get the latest release of <a href=\"https:\/\/www.docker.com\/products\/docker-desktop\/\" target=\"_blank\" rel=\"noopener\">Docker Desktop<\/a>.<\/p>\n<p>Have questions? The <a href=\"https:\/\/www.docker.com\/community\/\" target=\"_blank\" rel=\"noopener\">Docker community is here to help<\/a>.<\/p>\n<p>New to Docker? <a href=\"https:\/\/docs.docker.com\/desktop\/\" target=\"_blank\" rel=\"noopener\">Get started<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>We\u2019re excited to announce the launch of the Docker Terraform Provider, designed to help users and organizations automate and securely [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1346","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/1346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=1346"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/1346\/revisions"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=1346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=1346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=1346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}