Created
October 16, 2017 07:09
-
-
Save yamamoto-febc/42be324dcb8b3ae29195248baad9bc58 to your computer and use it in GitHub Desktop.
terraformでソースアーカイブIDが更新されても無視するための設定例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #パスワード定義 | |
| variable password {} | |
| # パブリックアーカイブ(OS)のID参照用のデータソース定義 | |
| data sakuracloud_archive "centos" { | |
| os_type = "centos" | |
| } | |
| # ディスク定義 | |
| resource "sakuracloud_disk" "disk01" { | |
| name = "disk01" | |
| source_archive_id = "${data.sakuracloud_archive.centos.id}" | |
| password = "${var.password}" | |
| #データソース(アーカイブ)のIDが変更されても無視する設定 | |
| lifecycle { | |
| ignore_changes = ["source_archive_id"] | |
| } | |
| } | |
| # サーバー定義 | |
| resource "sakuracloud_server" "server01" { | |
| name = "server01" | |
| disks = ["${sakuracloud_disk.disk01.id}"] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment