Skip to content

Commit

Permalink
Beta/v2.0.0 (#8)
Browse files Browse the repository at this point in the history
* add: github actions for releasing to registry

* chore: remove +x bit

* Merged code bases from julian3xl and nparfait - added numerous fixes to code base and updated SDKs etc.

* add: working example of deployment

* updated computed flag on some optional resources
  • Loading branch information
arnvid authored Jun 17, 2021
1 parent 7fb6674 commit e36f4b5
Show file tree
Hide file tree
Showing 24 changed files with 2,038 additions and 895 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/[email protected]
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Import GPG key
id: import_gpg
# TODO: move this to HashiCorp namespace or find alternative that is just simple gpg commands
# see https://github.com/hashicorp/terraform-provider-scaffolding/issues/22
uses: hashicorp/[email protected]
env:
# These secrets will need to be configured for the repository:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
example.tf
terraform.tfplan
terraform.tfstate
terraform.tfvars
dist/
vendor/
bin/
modules-dev/
Expand Down Expand Up @@ -39,4 +41,4 @@ website/vendor
node_modules


go.sum
go.sum
54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
- go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this in a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
# If you want to manually examine the release before its live, uncomment this line:
draft: true
changelog:
skip: true
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## WIP (**UNRELEASED**)

FEATURES:
* [nparfait] appstream/resource_fleet.go - state, stream_view
* [nparfait] appstream/resource_image_builder.go - access_endpoints
* [nparfait] appstream/resource_stack.go - access_endpoints, application_settings
* [julian3xl] appstream/resource_stack.go - embedded_domain
* [julian3xl] appstream/resource_stack_attachment.go - new resource
* [nparfait] appstream/appstream_usage_report_subscription.go - new resource

ENHANCEMENTS:
* [arnvid] upgraded go modules
* [arnvid] upgraded go api, sdk and interfaces
* [arnvid] appstream/provider.go - support for longer session times
* [julian3xl] appstream/resource_fleet.go - iam_role_arn -> optional
* [julian3xl] appstream/resource_fleet.go - added support for account local image_name
* [julian3xl] appstream/resource_fleet.go - update to vpc_config variable
* [julian3xl] appstream/resource_fleet.go - updated tagging
* [julian3xl] appstream/resource_fleet.go - cleaned up comments and errorlogs
* [julian3xl] appstream/resource_fleet.go - added idle_disconnect_timeout & enable_default_internet_access
* [julian3xl] appstream/resource_stack.go - updated user_settings.
* [other] appstream/resource_stack.go - multiple fixes

BUGFIXES:
* [suhussai] search for stack, fleet and image builder by name instead of listing all #5
* [julian3xl] api inconsistencies
* [arnvid] bug in optional variables forcing recreation

TOOLS:
* [nparfait] Added support for automated builds actions github actions
* [canha] some fixes to automated build tools for newer go lang

## 1.0.8 (June 15, 2020)

FEATURES:
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,52 @@
# terraform-provider-appstream




+This is an updated Terraform Appstream provider that covers almost all AWS SDK operations on Appstream service. This fork attempts to build a suitable provider that conforms as clossely as possible terraform provider standards.


# Provider usage

```
$ go build -o terraform-provider-appstream
$ go build ~/.terraform.d/plugins/terraform-provider-appstream (for terraform 0.12)
$ go build ~/.terraform.d/plugin-cache/registry.terraform.io/arnvid/appstream/1.0.x/<platform> (for terraform 0.13+)
$ terraform init
$ terraform plan
$ terraform apply
```

#Development notes
Several other terraform provider projects have been used to refrence how a module should be written,
Several other terraform provider projects have been used to reference how a module should be written,
The goal of this version is to be able to run properly with Terraform Cloud and Terraform Enterprise.
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




## Authors/Contributors/Forks
This fork is by:
[Arnvid Karstad](https://github.com/arnvid)

Contributors:
[Konstantin Odnoralov](https://github.com/hostmit)
[Syed Hussain](https://github.com/suhussai)

Original code from:
https://github.com/ops-guru/terraform-provider-appstream
[Viktor Berlov](https://github.com/vktr-brlv)

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

https://github.com/nparfait/terraform-provider-appstream
[Nicolas Parfait](https://github.com/nparfait)

https://github.com/julian3xl/terraform-provider-appstream
[julian3xl](https://github.com/julian3xl)

https://github.com/PMI-DEEP-Infra/terraform-provider-appstream
[PMI DEEP Infra Team](https://github.com/PMI-DEEP-Infra)
[Jorge Canha]([email protected])
67 changes: 34 additions & 33 deletions appstream/config.go
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
package appstream

import (
"fmt"
"log"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/service/appstream"
"github.com/aws/aws-sdk-go/service/imagebuilder"
awsbase "github.com/hashicorp/aws-sdk-go-base"
"github.com/hashicorp/terraform-plugin-sdk/helper/logging"
"fmt"
"log"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
)


type Config struct {
AccessKey string
SecretKey string
CredsFilename string
Profile string
Token string
Region string
MaxRetries int

AssumeRoleARN string
AssumeRoleExternalID string
AssumeRoleSessionName string
AssumeRolePolicy string

AllowedAccountIds []string
ForbiddenAccountIds []string

Endpoints map[string]string
AccessKey string
SecretKey string
CredsFilename string
Profile string
Token string
Region string
MaxRetries int

AssumeRoleARN string
AssumeRoleDurationSeconds int
AssumeRoleExternalID string
AssumeRoleSessionName string
AssumeRolePolicy string

AllowedAccountIds []string
ForbiddenAccountIds []string

Endpoints map[string]string
IgnoreTagPrefixes []string
IgnoreTags []string
Insecure bool
Insecure bool

SkipCredsValidation bool
SkipGetEC2Platforms bool
SkipRegionValidation bool
SkipRequestingAccountId bool
SkipMetadataApiCheck bool
S3ForcePathStyle bool
SkipCredsValidation bool
SkipGetEC2Platforms bool
SkipRegionValidation bool
SkipRequestingAccountId bool
SkipMetadataApiCheck bool
S3ForcePathStyle bool

terraformVersion string
terraformVersion string
}

type AWSClient struct {
Expand Down Expand Up @@ -119,14 +120,14 @@ func (c *Config) Client() (interface{}, error) {
dnsSuffix := "amazonaws.com"
if p, ok := endpoints.PartitionForRegion(endpoints.DefaultPartitions(), c.Region); ok {
dnsSuffix = p.DNSSuffix()
}
}

client := &AWSClient{
accountid: accountID,
appstreamconn: appstream.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appstream"])})),
dnsSuffix: dnsSuffix,
dnsSuffix: dnsSuffix,
imagebuilderconn: imagebuilder.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["imagebuilder"])})),
partition: partition,
partition: partition,
region: c.Region,
terraformVersion: c.terraformVersion,
}
Expand Down
Loading

0 comments on commit e36f4b5

Please sign in to comment.