Skip to content

Commit

Permalink
Add instance dns name (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
diogopms authored Jul 10, 2024
1 parent d78ff65 commit ab309f9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ resource "genesiscloud_instance" "example" {
### Read-Only

- `created_at` (String) The timestamp when this image was created in RFC 3339.
- `dns_name` (String) The dns name of the instance.
- `id` (String) The unique ID of the instance.
- `image_id` (String) The resulting image ID of the instance.
- `private_ip` (String) The private IPv4 IP-Address (IPv4 address).
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.22.1

require (
github.com/genesiscloud/genesiscloud-go v1.0.8
github.com/genesiscloud/genesiscloud-go v1.0.9
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-framework v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
github.com/genesiscloud/genesiscloud-go v1.0.8 h1:HiRHHaST1UOgsIAko739LPICB9SkgafalJHVu26DdKk=
github.com/genesiscloud/genesiscloud-go v1.0.8/go.mod h1:OAMjSCejQTC4BBLWXleegT/fg+X46SZ6t/vW9RPtXWg=
github.com/genesiscloud/genesiscloud-go v1.0.9 h1:IiRBbO7yRZYz9pBJbRfc3DRiai666T12k/4PvhZXOTw=
github.com/genesiscloud/genesiscloud-go v1.0.9/go.mod h1:OAMjSCejQTC4BBLWXleegT/fg+X46SZ6t/vW9RPtXWg=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ func (r *InstanceResource) Schema(ctx context.Context, req resource.SchemaReques
stringplanmodifier.UseStateForUnknown(), // immutable
},
}),
"dns_name": resourceenhancer.Attribute(ctx, schema.StringAttribute{
MarkdownDescription: "The dns name of the instance.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(), // immutable
},
}),
"id": resourceenhancer.Attribute(ctx, schema.StringAttribute{
MarkdownDescription: "The unique ID of the instance.",
Computed: true,
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ type InstanceResourceModel struct {
// Hostname The hostname of your instance.
Hostname types.String `tfsdk:"hostname"`

// DnsName The dns name of your instance.
DnsName types.String `tfsdk:"dns_name"`

// Id The unique ID of the instance.
Id types.String `tfsdk:"id"`

Expand Down Expand Up @@ -92,6 +95,7 @@ func (data *InstanceResourceModel) PopulateFromClientResponse(ctx context.Contex
data.Id = types.StringValue(instance.Id)
data.Name = types.StringValue(instance.Name)
data.Hostname = types.StringValue(instance.Hostname)
data.DnsName = types.StringValue(instance.DnsName)
data.Type = types.StringValue(string(instance.Type))
data.ImageId = types.StringValue(instance.Image.Id)

Expand Down

0 comments on commit ab309f9

Please sign in to comment.