Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update create instance docs #65

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ data "genesiscloud_images" "base-os" {
}
}

locals {
image_id = data.genesiscloud_images.base-os.images[index(data.genesiscloud_images.base-os.images.*.name, "Ubuntu 20.04")].id
}

resource "genesiscloud_ssh_key" "alice" {
name = "alice"
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBOpdKM8wSI07+PO4xLDL7zW/kNWGbdFXeHyBU1TRlBn alice@example.com"
Expand Down Expand Up @@ -110,7 +106,7 @@ resource "genesiscloud_instance" "instance" {
name = "terraform-instance"
region = local.region

image = local.image_id
image = "ubuntu-22.04"
type = "vcpu-4_memory-12g_disk-80g_nvidia3080-1"

ssh_key_ids = [
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resource "genesiscloud_instance" "example" {

### Required

- `image` (String) The source image or snapshot of the instance.
- `image` (String) The source image id, image slug or snapshot id of the instance. The image version can also specified together with the image slug in this format `<image-slug>:<version>`. Learn more about images [here](https://developers.genesiscloud.com/images).
- If the value of this attribute changes, Terraform will destroy and recreate the resource.
- `name` (String) The human-readable name for the instance.
- `region` (String) The region identifier.
Expand Down
6 changes: 1 addition & 5 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ data "genesiscloud_images" "base-os" {
}
}

locals {
image_id = data.genesiscloud_images.base-os.images[index(data.genesiscloud_images.base-os.images.*.name, "Ubuntu 20.04")].id
}

resource "genesiscloud_ssh_key" "alice" {
name = "alice"
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBOpdKM8wSI07+PO4xLDL7zW/kNWGbdFXeHyBU1TRlBn alice@example.com"
Expand Down Expand Up @@ -86,7 +82,7 @@ resource "genesiscloud_instance" "instance" {
name = "terraform-instance"
region = local.region

image = local.image_id
image = "ubuntu-22.04"
type = "vcpu-4_memory-12g_disk-80g_nvidia3080-1"

ssh_key_ids = [
Expand Down
6 changes: 4 additions & 2 deletions internal/provider/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ func (r *InstanceResource) Schema(ctx context.Context, req resource.SchemaReques
},
}),
"image": resourceenhancer.Attribute(ctx, schema.StringAttribute{
MarkdownDescription: "The source image or snapshot of the instance.",
Required: true,
MarkdownDescription: "The source image id, image slug or snapshot id of the instance. " +
"The image version can also specified together with the image slug in this format `<image-slug>:<version>`. " +
"Learn more about images [here](https://developers.genesiscloud.com/images).",
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand Down
Loading