From 9f06d8a0859d6d90e83073f8dd5b298cec54fab9 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 1 May 2019 15:45:54 -0700 Subject: [PATCH] Update attached disk documentation (#3413) Original Author: @chrisst --- .../r/compute_attached_disk.html.markdown | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/website/docs/r/compute_attached_disk.html.markdown b/website/docs/r/compute_attached_disk.html.markdown index 6842acc9..e8ea4037 100644 --- a/website/docs/r/compute_attached_disk.html.markdown +++ b/website/docs/r/compute_attached_disk.html.markdown @@ -22,6 +22,7 @@ To get more information about attaching disks, see: * How-to Guides * [Adding a persistent disk](https://cloud.google.com/compute/docs/disks/add-persistent-disk) +**Note:** When using `compute_attached_disk` you **must** use `lifecycle.ignore_changes = ["attached_disk"]` on the `compute_instance` resource that has the disks attached. Otherwise the two resources will fight for control of the attached disk block. ## Example Usage ```hcl @@ -29,6 +30,27 @@ resource "google_compute_attached_disk" "default" { disk = "${google_compute_disk.default.self_link}" instance = "${google_compute_instance.default.self_link}" } + +resource "google_compute_instance" "default" { + name = "attached-disk-instance" + machine_type = "n1-standard-1" + zone = "us-west1-a" + + + boot_disk { + initialize_params { + image = "debian-cloud/debian-9" + } + } + + network_interface { + network = "default" + } + + lifecycle { + ignore_changes = ["attached_disk"] + } +} ``` ## Argument Reference @@ -77,7 +99,7 @@ The following arguments are supported: The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode. - + Possible values: "READ_ONLY" "READ_WRITE"