How do I create a VM instance in GCP with the latest snapshot using Terraform?
455 views
Skip to first unread message
Eric Mwaura
unread,
Apr 29, 2021, 10:04:17 AM4/29/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gce-discussion
know I have to first create a compute_disk , then reference the snapshot I want to use; however since snapshots are constantly updated, how would I make sure that terraform is using the most recent snapshot to create the Instance?
Digil (Google Cloud Platform Support)
unread,
May 3, 2021, 11:35:59 AM5/3/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gce-discussion
By using the orderBy="creationTimestamp desc"while listing the snapshots, it should gives you a lists of snapshots in reverse chronological order (newest result first). So before creating the GCE VM using terraform, you need to decide the snapshot with the help of orderBy="creationTimestamp desc"query parameter. I am not sure how this logic can be included in your terraform script, but I believe you could find a solution by posting the concern in 'Terraform's community support' forums.
Kumar Dhanagopal
unread,
May 4, 2021, 1:14:03 PM5/4/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message