From e6c20765663be1f55cfcd6a12d827aba7a4c9f64 Mon Sep 17 00:00:00 2001 From: Arnvid Karstad Date: Tue, 9 Jun 2020 16:27:07 +0200 Subject: [PATCH] Iam role added (#2) * init * typo fixed Co-authored-by: Konstantin Odnoralov --- appstream/resource_fleet.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/appstream/resource_fleet.go b/appstream/resource_fleet.go index b80400e..695c7a3 100644 --- a/appstream/resource_fleet.go +++ b/appstream/resource_fleet.go @@ -77,6 +77,12 @@ func resourceAppstreamFleet() *schema.Resource { }, "image_arn": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "iam_role_arn": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -190,6 +196,10 @@ func resourceAppstreamFleetCreate(d *schema.ResourceData, meta interface{}) erro CreateFleetInputOpts.ImageArn = aws.String(v.(string)) } + if v, ok := d.GetOk("iam_role_arn"); ok { + CreateFleetInputOpts.IamRoleArn = aws.String(v.(string)) + } + if v, ok := d.GetOk("instance_type"); ok { CreateFleetInputOpts.InstanceType = aws.String(v.(string)) @@ -350,6 +360,7 @@ func resourceAppstreamFleetRead(d *schema.ResourceData, meta interface{}) error d.Set("enable_default_internet_access", v.EnableDefaultInternetAccess) d.Set("fleet_type", v.FleetType) d.Set("image_arn", v.ImageArn) + d.Set("iam_role_arn", v.IamRoleArn) d.Set("instance_type", v.InstanceType) d.Set("max_user_duration", v.MaxUserDurationInSeconds) @@ -429,6 +440,13 @@ func resourceAppstreamFleetUpdate(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] Modify Fleet") image_arn :=d.Get("image_arn").(string) UpdateFleetInputOpts.ImageArn = aws.String(image_arn) + } + + if d.HasChange("iam_role_arn") { + d.SetPartial("iam_role_arn") + log.Printf("[DEBUG] Modify Fleet") + iam_role_arn :=d.Get("iam_role_arn").(string) + UpdateFleetInputOpts.IamRoleArn = aws.String(iam_role_arn) } if d.HasChange("instance_type") {