Basic configuration file : Deployment Manager

  • date 10th July, 2021 |
  • by Prwatech |
  • 0 Comments

Deployment Manager configuration file structure

 

Deployment Manager configuration files are YAML or Jinja2 templates used to define and manage cloud resources in Google Cloud Platform (GCP). These configuration files follow a specific structure that dictates how resources are provisioned, configured, and connected within GCP environments.

At the core of a Deployment Manager configuration file is the definition of resources, such as virtual machines, storage buckets, networking components, and more. Each resource is described using YAML or Jinja2 syntax, specifying attributes such as resource type, name, properties, and dependencies.

Deployment Manager configuration files also support referencing variables, templates, and imports, enabling users to parameterize configurations, reuse code snippets, and organize complex deployments effectively. Additionally, these files may include metadata, outputs, and other declarations to further customize and enhance the deployment process.

 

Prerequisites

GCP account

Open Console.

Open the cloud shell

To list of all supported types

$ gcloud deployment-manager types list

Create a file with extension .yaml. This will be your configuration file.

$ nano vm.yaml

Paste the code below into that file.

# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
resources:
- name: vm-created-by-deployment-manager
  type: compute.v1.instance
  properties:
    zone: us-central1-a
    machineType: zones/us-central1-a/machineTypes/n1-standard-1
    disks:
    - deviceName: boot
      type: PERSISTENT
      boot: true
      autoDelete: true
      initializeParams:
        sourceImage: projects/debian-cloud/global/images/family/debian-9
    networkInterfaces:
    - network: global/networks/default

To close, Press ctrl+x  then y  to confirm. Then enter. The file will be saved.

Preview a configuration 
$     gcloud deployment-manager deployments create example-config --config configuration-file.yaml --preview
Canceling a preview
$     gcloud deployment-manager deployments cancel-preview example-config
Deleting a preview
$     gcloud deployment-manager deployments delete example-config
Deploying a preview
$     gcloud deployment-manager deployments update example-config

 

Deployment Manager configuration file structure

0
0

Quick Support

image image