Add "terraform" tag to terraform-created DO resources

This commit is contained in:
Jeremy Dormitzer 2021-01-22 11:42:39 -05:00
parent c473a6807d
commit 9b5fd90e9f
5 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/digitalocean/digitalocean" {
version = "2.3.0"
constraints = "~> 2.3.0"
hashes = [
"h1:Kmcj3ajzt/lSQkbQwcjzUNK2RXXcHNDCs44LfDhZnaM=",
"zh:1c0f68715cf0b84ab40ab08aa59232037325cffc2896ba109cae73c81ab021e9",
"zh:306599aec6637c92349abb069d8fea3ebac58f52f61707956320a405f57e4a84",
"zh:31db532f05e55cb52d61c12c10197dca48dc8809a4f9cc4a935d3161546968ca",
"zh:3dba438c0167e5dcf09115f8d2c33c0a821e6b27e83ec6ccaac5fcb557a50bbb",
"zh:770c906ab3eeb5c24c5b8bbcca3b18f137d5ac817bd73fa5c9146eb4a9d891d6",
"zh:9221f2d275c776382234882d534a1147db04a8be490c023eb08c9a1e579db021",
"zh:a4e25e5dd2ad06de6c7148a270b1178b6298846405ce66b9b4ca51ea35b66907",
"zh:b3c5555e0c55efaa91de245e6d69e7140665554d2365db2f664802a36b59e0a8",
"zh:c510655b6c5de0227babba5a8bb66a8c3d92af94e080ec1c39bde9509a2aa1a6",
"zh:d04a135d9bf32c1a55abaaeb719903f4f67797434dd6d9f3219245f62a9a66be",
"zh:dd5b99bec9425eb670be5d19b17336d0fa9b894649dac77eac532e4c626616f5",
"zh:e57614fb9f3fbf774a9258a197840f40d0f343e8183eef7a842286a87cfc48d7",
"zh:fee52e736edc5ef4088cedae6507790f35e4ee8a078bff1ef894a51dd65d058d",
]
}

View File

@ -10,4 +10,5 @@ resource "digitalocean_droplet" "git_jeremydormitzer_com" {
region = "nyc3"
size = "s-1vcpu-1gb"
backups = true
tags = ["terraform"]
}

View File

@ -19,6 +19,7 @@ resource "digitalocean_volume" "syncthing_volume" {
size = 100
initial_filesystem_label = "syncthing-volume"
initial_filesystem_type = "ext4"
tags = ["terraform"]
lifecycle {
prevent_destroy = true

View File

@ -39,6 +39,12 @@ variable "backups" {
default = true
}
variable "tags" {
description = "List of tags to be applied to created resources"
type = list(string)
default = ["terraform"]
}
output "droplet_id" {
description = "Droplet ID"
value = digitalocean_droplet.droplet.id

View File

@ -36,6 +36,7 @@ resource "digitalocean_droplet" "droplet" {
region = var.region
size = var.droplet_size
backups = var.backups
tags = var.tags
ssh_keys = [
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_laptop_ssh_key_id,
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_macbook_lola_ssh_key_id