Skip to content

Commit

Permalink
Merge branch 'master' of github.com:arnvid/terraform-provider-appstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnvid Lau Karstad committed May 27, 2020
2 parents 383650f + 4b8583f commit fac7f9c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ website/vendor
*.winfile eol=crlf
/.vs
node_modules


go.sum
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ The goal of this version is to be able to run properly with Terraform Cloud and
Along side with removing the need for access and secret key in variables and only pass the necessary
to be assumed.


Large portions of code for authentication in config.go & provider.go is from:
https://github.com/terraform-providers/terraform-provider-aws



Expand All @@ -30,7 +31,6 @@ Original code from:
https://github.com/ops-guru/terraform-provider-appstream
[Viktor Berlov](https://github.com/vktr-brlv)

Noteable forks refrenced:
Other forks ref'd:
https://github.com/bluesentry/terraform-provider-appstream
[Chris Mackubin](https://github.com/chris-mackubin)

24 changes: 13 additions & 11 deletions appstream/resource_fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ func resourceAppstreamFleet() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},

"image_name": {
"image_arn": {
Type: schema.TypeString,
Required: true,
Required: true,
ForceNew: true,
},

"instance_type": {
Expand Down Expand Up @@ -185,10 +186,11 @@ func resourceAppstreamFleetCreate(d *schema.ResourceData, meta interface{}) erro
CreateFleetInputOpts.FleetType = aws.String(v.(string))
}

if v, ok := d.GetOk("image_name"); ok {
CreateFleetInputOpts.ImageName = aws.String(v.(string))
if v, ok := d.GetOk("image_arn"); ok {
CreateFleetInputOpts.ImageArn = aws.String(v.(string))
}


if v, ok := d.GetOk("instance_type"); ok {
CreateFleetInputOpts.InstanceType = aws.String(v.(string))
}
Expand Down Expand Up @@ -347,7 +349,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("image_name", v.ImageName)
d.Set("image_arn", v.ImageArn)
d.Set("instance_type", v.InstanceType)
d.Set("max_user_duration", v.MaxUserDurationInSeconds)

Expand Down Expand Up @@ -402,7 +404,7 @@ func resourceAppstreamFleetUpdate(d *schema.ResourceData, meta interface{}) erro
}

if d.HasChange("description") {
d.SetPartial("description")
d.SetPartial("description")
log.Printf("[DEBUG] Modify Fleet")
description :=d.Get("description").(string)
UpdateFleetInputOpts.Description = aws.String(description)
Expand All @@ -422,11 +424,11 @@ func resourceAppstreamFleetUpdate(d *schema.ResourceData, meta interface{}) erro
UpdateFleetInputOpts.DisplayName = aws.String(display_name)
}

if d.HasChange("image_name") {
d.SetPartial("image_name")
if d.HasChange("image_arn") {
d.SetPartial("image_arn")
log.Printf("[DEBUG] Modify Fleet")
image_name :=d.Get("image_name").(string)
UpdateFleetInputOpts.ImageName = aws.String(image_name)
image_arn :=d.Get("image_arn").(string)
UpdateFleetInputOpts.ImageArn = aws.String(image_arn)
}

if d.HasChange("instance_type") {
Expand Down
9 changes: 5 additions & 4 deletions appstream/resource_image_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ func resourceAppstreamImageBuilder() *schema.Resource {
Optional: true,
},

"image_name": {
"image_arn": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"instance_type": {
Expand Down Expand Up @@ -136,8 +137,8 @@ func resourceAppstreamImageBuilderCreate(d *schema.ResourceData, meta interface{
CreateImageBuilderInputOpts.EnableDefaultInternetAccess = aws.Bool(v.(bool))
}

if v, ok := d.GetOk("image_name"); ok {
CreateImageBuilderInputOpts.ImageName = aws.String(v.(string))
if v, ok := d.GetOk("image_arn"); ok {
CreateImageBuilderInputOpts.ImageArn = aws.String(v.(string))
}

if v, ok := d.GetOk("instance_type"); ok {
Expand Down Expand Up @@ -226,7 +227,7 @@ func resourceAppstreamImageBuilderRead(d *schema.ResourceData, meta interface{})
d.Set("appstream_agent_version", v.AppstreamAgentVersion)
d.Set("enable_default_internet_access", v.EnableDefaultInternetAccess)
d.Set("instance_type", v.InstanceType)
d.Set("image_name", d.Get("image_name"))
d.Set("image_arn", d.Get("image_arn"))
d.Set("state", v.State)
if v.VpcConfig != nil {
vpc_attr := map[string]interface{}{}
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.14
require (
github.com/aws/aws-sdk-go v1.30.19
github.com/hashicorp/aws-sdk-go-base v0.4.0
github.com/hashicorp/terraform v0.12.24
github.com/hashicorp/terraform v0.12.25
github.com/hashicorp/terraform-plugin-sdk v1.11.0
github.com/mitchellh/go-homedir v1.1.0
)

0 comments on commit fac7f9c

Please sign in to comment.