Skip to content

Commit

Permalink
Iam role added (#2)
Browse files Browse the repository at this point in the history
* init

* typo fixed

Co-authored-by: Konstantin Odnoralov <[email protected]>
  • Loading branch information
Arnvid Karstad and Konstantin Odnoralov authored Jun 9, 2020
1 parent fac7f9c commit e6c2076
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions appstream/resource_fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit e6c2076

Please sign in to comment.