{"id":9610,"date":"2021-07-10T11:00:13","date_gmt":"2021-07-10T11:00:13","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=9610"},"modified":"2024-03-21T07:36:04","modified_gmt":"2024-03-21T07:36:04","slug":"deployment-manager-adding-templates","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/","title":{"rendered":"Deployment manager : Adding Templates"},"content":{"rendered":"\r\n<h2><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Adding templates in Deployment Manager configuration&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:513,&quot;3&quot;:{&quot;1&quot;:0},&quot;12&quot;:0}\">Adding templates in Deployment Manager configuration<\/span><\/h2>\r\n<p>Adding templates in Deployment Manager configuration files enables users to modularize their infrastructure-as-code (IaC) deployments in Google Cloud Platform (GCP). Templates allow users to define reusable configurations for cloud resources, promoting consistency, efficiency, and maintainability in deployment workflows.<\/p>\r\n<p>Templates in files typically follow either YAML or Jinja2 syntax, allowing users to define resource configurations, properties, and dependencies in a structured manner. Users can create templates for individual resources, such as virtual machines, networks, or storage buckets, as well as for more complex deployments involving multiple resources and dependencies.<\/p>\r\n<p>To add templates in Deployment Manager configuration files, users can define template files containing the desired resource configurations and properties. These template files can then be referenced and included within the main configuration file using the imports or templates sections, depending on the syntax being used.<\/p>\r\n<p><strong><a href=\"https:\/\/cloud.google.com\/free\/?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=japac-IN-all-en-dr-BKWS-all-core-trial-EXA-dr-1605216&amp;utm_content=text-ad-none-none-DEV_c-CRE_644159077391-ADGP_Hybrid+%7C+BKWS+-+EXA+%7C+Txt+~+GCP_General_core+brand_main-KWID_43700074766895889-aud-970366092687:kwd-87853815&amp;userloc_9062009-network_g&amp;utm_term=KW_gcp&amp;gad_source=1&amp;gclid=CjwKCAjw7-SvBhB6EiwAwYdCAR4cDE-TsZ_kVCYCYR1mZTa-kz1Gw1XbOOsZqzwmt_zR6_Ql78ybzhoCRi0QAvD_BwE&amp;gclsrc=aw.ds\">Creating<\/a> a basic <a href=\"https:\/\/prwatech.in\/blog\/\">template<\/a><\/strong><\/p>\r\n\r\n\r\n\r\n<p>A template is a file you create, written in either Jinja or Python<\/p>\r\n\r\n\r\n\r\n<p>Create a file with extension .jinja.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9602\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg\" alt=\"\" width=\"773\" height=\"36\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg 720w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8-300x14.jpg 300w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Paste the below code<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">resources:\r\n- name: vm-template\r\n\u00a0 type: compute.v1.instance\r\n\u00a0 properties:\r\n\u00a0 \u00a0 zone: us-central1-a\r\n\u00a0 \u00a0 machineType: zones\/us-central1-a\/machineTypes\/n1-standard-1\r\n\u00a0 \u00a0 disks:\r\n\u00a0 \u00a0 - deviceName: boot\r\n\u00a0 \u00a0 \u00a0 type: PERSISTENT\r\n\u00a0 \u00a0 \u00a0 boot: true\r\n\u00a0 \u00a0 \u00a0 autoDelete: true\r\n\u00a0 \u00a0 \u00a0 initializeParams:\r\n\u00a0 \u00a0 \u00a0 \u00a0 sourceImage: projects\/debian-cloud\/global\/images\/family\/debian-9\r\n\u00a0 \u00a0 networkInterfaces:\r\n\u00a0 \u00a0 - network: global\/networks\/default<\/pre>\r\n\r\n\r\n\r\n<p>Press ctrl+x\u00a0 then y\u00a0 then enter. The file will be saved.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9603\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/9.jpg\" alt=\"\" width=\"660\" height=\"290\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/9.jpg 719w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/9-300x131.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">Type $   pwd. It will show the path of file located.<\/pre>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"50\" class=\"wp-image-9604\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/9a.jpg\" alt=\"\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/9a.jpg 558w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/9a-300x27.jpg 300w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Create a configuration file with extension .yaml<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$       nano vm-config.yaml<\/pre>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9605\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/10.jpg\" alt=\"\" width=\"766\" height=\"37\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/10.jpg 696w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/10-300x15.jpg 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Paste the below code<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">imports:\r\n- path: path\/my_vm_template.jinja\r\nresources:\r\n- name: my-first-virtual-machine\r\n\u00a0 type: path\/to\/my_vm_template.jinja<\/pre>\r\n\r\n\r\n\r\n<p>Press ctrl+x\u00a0 then y\u00a0 then enter. The file will be saved.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9606\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/image-62.png\" alt=\"\" width=\"719\" height=\"485\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/image-62.png 617w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/image-62-300x203.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Then you can deploy the configuration file that contains the templates.<\/p>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\">Deploying templates directly with the command-line tool<\/h4>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$   gcloud deployment-manager deployments create a-single-vm \u00a0\u00a0--template vm_template.jinja<\/pre>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9607\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/image-63.png\" alt=\"\" width=\"747\" height=\"160\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/image-63.png 627w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/image-63-300x65.png 300w\" sizes=\"auto, (max-width: 747px) 100vw, 747px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Adding templates in Deployment Manager configuration Adding templates in Deployment Manager configuration files enables users to modularize their infrastructure-as-code (IaC) deployments in Google Cloud Platform (GCP). Templates allow users to define reusable configurations for cloud resources, promoting consistency, efficiency, and maintainability in deployment workflows. Templates in files typically follow either YAML or Jinja2 syntax, allowing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,1629],"tags":[1545,1544,605,699,700,984,617,683,684,685,611,1400,692,1546],"class_list":["post-9610","post","type-post","status-publish","format-standard","hentry","category-google-cloud-platform","category-instance","tag-deployment-configuration","tag-deployment-manager","tag-gcp","tag-gcp-certification","tag-gcp-cloud-console","tag-gcp-course","tag-google-cloud","tag-google-cloud-certification","tag-google-cloud-console","tag-google-cloud-courses","tag-google-cloud-platform","tag-google-cloud-platform-tutorial","tag-google-cloud-training","tag-template"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding templates in Deployment Manager configuration - Prwatech<\/title>\n<meta name=\"description\" content=\"Master Adding Templates in Deployment Manager Configuration - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding templates in Deployment Manager configuration - Prwatech\" \/>\n<meta property=\"og:description\" content=\"Master Adding Templates in Deployment Manager Configuration - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-10T11:00:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-21T07:36:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/\",\"url\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/\",\"name\":\"Adding templates in Deployment Manager configuration - Prwatech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg\",\"datePublished\":\"2021-07-10T11:00:13+00:00\",\"dateModified\":\"2024-03-21T07:36:04+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Master Adding Templates in Deployment Manager Configuration - Dive deep with our expert instructors and comprehensive curriculum.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg\",\"width\":720,\"height\":34},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deployment manager : Adding Templates\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding templates in Deployment Manager configuration - Prwatech","description":"Master Adding Templates in Deployment Manager Configuration - Dive deep with our expert instructors and comprehensive curriculum.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Adding templates in Deployment Manager configuration - Prwatech","og_description":"Master Adding Templates in Deployment Manager Configuration - Dive deep with our expert instructors and comprehensive curriculum.","og_url":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2021-07-10T11:00:13+00:00","article_modified_time":"2024-03-21T07:36:04+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/","url":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/","name":"Adding templates in Deployment Manager configuration - Prwatech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg","datePublished":"2021-07-10T11:00:13+00:00","dateModified":"2024-03-21T07:36:04+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Master Adding Templates in Deployment Manager Configuration - Dive deep with our expert instructors and comprehensive curriculum.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/07\/8.jpg","width":720,"height":34},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/google-cloud-platform\/instance\/deployment-manager-adding-templates\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Deployment manager : Adding Templates"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=9610"}],"version-history":[{"count":5,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9610\/revisions"}],"predecessor-version":[{"id":11069,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9610\/revisions\/11069"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=9610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=9610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=9610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}