Skip to content

Commit

Permalink
add idle disconnect var to fleet
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Parfait committed Apr 11, 2021
1 parent 10a3b4c commit fa3eb61
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
19 changes: 18 additions & 1 deletion appstream/resource_fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ func resourceAppstreamFleet() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},


"idle_disconnect_timeout": {
Type: schema.TypeInt,
Optional: true,
},

"image_arn": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -198,6 +203,10 @@ func resourceAppstreamFleetCreate(d *schema.ResourceData, meta interface{}) erro
CreateFleetInputOpts.FleetType = aws.String(v.(string))
}

if v, ok := d.GetOk("idle_disconnect_timeout"); ok {
CreateFleetInputOpts.IdleDisconnectTimeoutInSeconds = aws.Int64(int64(v.(int)))
}

if v, ok := d.GetOk("image_arn"); ok {
CreateFleetInputOpts.ImageArn = aws.String(v.(string))
}
Expand Down Expand Up @@ -369,6 +378,7 @@ func resourceAppstreamFleetRead(d *schema.ResourceData, meta interface{}) error
d.Set("disconnect_timeout", v.DisconnectTimeoutInSeconds)
d.Set("enable_default_internet_access", v.EnableDefaultInternetAccess)
d.Set("fleet_type", v.FleetType)
d.Set("idle_disconnect_timeout", v.IdleDisconnectTimeoutInSeconds)
d.Set("image_arn", v.ImageArn)
d.Set("iam_role_arn", v.IamRoleArn)
d.Set("instance_type", v.InstanceType)
Expand Down Expand Up @@ -446,6 +456,13 @@ func resourceAppstreamFleetUpdate(d *schema.ResourceData, meta interface{}) erro
UpdateFleetInputOpts.DisplayName = aws.String(display_name)
}

if d.HasChange("idle_disconnect_timeout") {
d.SetPartial("idle_disconnect_timeout")
log.Printf("[DEBUG] Modify Fleet")
idle_disconnect_timeout := d.Get("idle_disconnect_timeout").(int)
UpdateFleetInputOpts.IdleDisconnectTimeoutInSeconds = aws.Int64(int64(idle_disconnect_timeout))
}

if d.HasChange("image_arn") {
d.SetPartial("image_arn")
log.Printf("[DEBUG] Modify Fleet")
Expand Down
3 changes: 2 additions & 1 deletion examples/appstream.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ resource "appstream_fleet" "test-fleet" {
display_name = "test-fleet"
enable_default_internet_access = true
fleet_type = "ON_DEMAND"
image_arn = "arn:aws:appstream:eu-west-1:1231241241:image/Base-Image-Builder-05-02-2018"
idle_disconnect_timeout = 300
image_arn = "arn:aws:appstream:eu-west-1:1231241241:image/Base-Image-Builder-05-02-2018"
instance_type = "stream.standard.large"
max_user_duration = 600
iam_role_arn = ""
Expand Down

0 comments on commit fa3eb61

Please sign in to comment.