0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GCP deployment-managerでnetworkを作成してみた

Posted at

概要

デプロイメントマネージャでネットワークを作成してみました。
デプロイメント名:my-first-deployment
ネットワーク名:a-new-network

参考にしたページは以下の通り。
https://cloud.google.com/deployment-manager/docs/deployments/updating-deployments?hl=ja
https://cloud.google.com/deployment-manager/docs/configuration/use-references?hl=ja

ソースコード

以下の通りYAMLで記述した。

network.yaml
resources:
- name: a-new-network
  type: compute.v1.network
  properties:
    routingConfig:
      routingMode: REGIONAL
    autoCreateSubnetworks: true

実行結果

まずは以下で認証してもらう。

$ gcloud auth login

YAMLを読み込んで、プレビュー状態にする。

$ gcloud deployment-manager deployments create my-first-deployment --config network.yaml --preview
The fingerprint of the deployment is 0GcTB20tvYp_NL4tfUjPWg==
Waiting for create [operation-1681473514752-5f94a8f8bcabb-f0c62b2a-83339091]...done.                                                                                                                      
Create operation operation-1681473514752-5f94a8f8bcabb-f0c62b2a-83339091 completed successfully.
NAME           TYPE                STATE       ERRORS  INTENT
a-new-network  compute.v1.network  IN_PREVIEW  []      CREATE_OR_ACQUIRE

デプロイメントを更新する。無事リソースの作成が完了。

$ gcloud deployment-manager deployments update my-first-deployment 
The fingerprint of the deployment is C3-t8xuNooa1IGYShQiMhw==
Waiting for update [operation-1681473752498-5f94a9db781cf-da01e28b-b1c45a54]...done.                                                                                                                      
Update operation operation-1681473752498-5f94a9db781cf-da01e28b-b1c45a54 completed successfully.
NAME           TYPE                STATE      ERRORS  INTENT
a-new-network  compute.v1.network  COMPLETED  []

ネットワークが作成されたかをCUIで確認。

$ gcloud compute networks list
NAME             SUBNET_MODE  BGP_ROUTING_MODE  IPV4_RANGE  GATEWAY_IPV4
a-new-network    AUTO         REGIONAL
datalab-network  AUTO         REGIONAL
default          AUTO         REGIONAL

ネットワークが作成されたのをGUIで確認。

Screenshot from 2023-04-14 21-06-08.png

デプロイメントの中身もGUIで確認。

Screenshot from 2023-04-14 21-07-33.png

何かの役に立てばと。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?