-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the instance documentation example to match all changes (#282)
Co-authored-by: Fernando Villalba <fernando@civo.com>
- Loading branch information
1 parent
ffca8c9
commit 9b71364
Showing
1 changed file
with
24 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
# Query small instance size | ||
data "civo_instances_size" "small" { | ||
filter { | ||
key = "name" | ||
values = ["g3.small"] | ||
match_by = "re" | ||
} | ||
|
||
filter { | ||
key = "type" | ||
values = ["instance"] | ||
} | ||
|
||
provider "civo" { | ||
|
||
region = "LON1" | ||
} | ||
|
||
resource "civo_firewall" "example" { | ||
name = "example-firewall" | ||
create_default_rules = true | ||
network_id = civo_network.example.id | ||
|
||
} | ||
|
||
# Query instance disk image | ||
data "civo_disk_image" "debian" { | ||
filter { | ||
key = "name" | ||
values = ["debian-10"] | ||
} | ||
resource "civo_network" "example" { | ||
label = "example-network3" | ||
|
||
} | ||
|
||
# Create a new instance | ||
resource "civo_instance" "foo" { | ||
hostname = "foo.com" | ||
tags = ["python", "nginx"] | ||
notes = "this is a note for the server" | ||
size = element(data.civo_instances_size.small.sizes, 0).name | ||
disk_image = element(data.civo_disk_image.debian.diskimages, 0).id | ||
resource "civo_instance" "example" { | ||
hostname = "example-instance" | ||
tags = ["nginx"] | ||
notes = "Created with TF" | ||
size = "g3.xsmall" # List on CLI: civo instances size | ||
network_id = civo_network.example.id | ||
firewall_id = civo_firewall.example.id | ||
disk_image = "debian-11" # List on CLI: civo diskimage ls | ||
} | ||
|
||
# View instances on dashboard: https://dashboard.civo.com/instances | ||
# View instances on CLI: civo instance ls |