Skip to content

Instantly share code, notes, and snippets.

@yamamoto-febc
Created October 16, 2017 07:09
Show Gist options
  • Save yamamoto-febc/42be324dcb8b3ae29195248baad9bc58 to your computer and use it in GitHub Desktop.
Save yamamoto-febc/42be324dcb8b3ae29195248baad9bc58 to your computer and use it in GitHub Desktop.
terraformでソースアーカイブIDが更新されても無視するための設定例
#パスワード定義
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