Skip to content

Commit

Permalink
Fix placement option (#56)
Browse files Browse the repository at this point in the history
* Fix placement option

* Update docs for placement_option
  • Loading branch information
skirsten authored Feb 21, 2024
1 parent 2be4d79 commit 673e8a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ resource "genesiscloud_instance" "example" {
- `password` (String, Sensitive) The password to access the instance. Your password must have upper and lower chars, digits and length between 8-72. **Please Note**: Only one of `ssh_keys` or `password` can be provided. Password is less secure - we recommend you use an SSH key-pair.
- If the value of this attribute changes, Terraform will destroy and recreate the resource.
- The string length must be at least 16.
- `placement_option` (String) The placement option identifier in which instances are physically located relative to each other within a zone.
- `placement_option` (String) The placement option identifier in which instances are physically located relative to each other within a zone. For example A or B.
- If the value of this attribute changes, Terraform will destroy and recreate the resource.
- `security_group_ids` (Set of String) The security groups of the instance. If not provided will be set to the default security group.
- `ssh_key_ids` (Set of String) The ssh keys of the instance.
Expand Down
7 changes: 5 additions & 2 deletions internal/provider/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (r *InstanceResource) Schema(ctx context.Context, req resource.SchemaReques
},
}),
"placement_option": resourceenhancer.Attribute(ctx, schema.StringAttribute{
MarkdownDescription: "The placement option identifier in which instances are physically located relative to each other within a zone.",
MarkdownDescription: "The placement option identifier in which instances are physically located relative to each other within a zone. For example A or B.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
Expand Down Expand Up @@ -284,7 +284,10 @@ func (r *InstanceResource) Create(ctx context.Context, req resource.CreateReques
}

body.Region = genesiscloud.Region(data.Region.ValueString())
body.PlacementOption = pointer(data.PlacementOption.ValueString())

if !data.PlacementOption.IsNull() && !data.PlacementOption.IsUnknown() {
body.PlacementOption = pointer(data.PlacementOption.ValueString())
}

response, err := r.client.CreateInstanceWithResponse(ctx, body)
if err != nil {
Expand Down

0 comments on commit 673e8a3

Please sign in to comment.