Google Cloud DNSで設定ファイルをimport/exportする
Cloud Deployment Manager にはGoogle Cloud DNSを設定する機能がないっぽいですが、代わりにgcloud dns
コマンドが使えそうです。
コマンド例
エクスポート
↓のコマンドを打つと
gcloud dns record-sets export -z example-com-zone example-com-zone.yml
↓のようなYAML形式で出力されます。
--- kind: dns#resourceRecordSet name: example.com. rrdatas: - ns-cloud-c1.googledomains.com. - ns-cloud-c2.googledomains.com. - ns-cloud-c3.googledomains.com. - ns-cloud-c4.googledomains.com. ttl: 21600 type: NS --- kind: dns#resourceRecordSet name: example.com. rrdatas: - ns-cloud-c1.googledomains.com. cloud-dns-hostmaster.google.com. 3 21600 3600 1209600 300 ttl: 21600 type: SOA
インポート
↓のコマンドでYAML形式のファイルをインポートできます。
gcloud dns record-sets import --delete-all-existing -z example-com-zone example-com-zone.yml
ポイント
- インポート時には
--delete-all-existing
を指定しないとダメなよう - 書式にエラーがある場合は更新されないので、中途半端な状態にならないかは気にしなくて大丈夫なよう