diff --git a/.circleci/config.yml b/.circleci/config.yml index 4cd264b6..7a7237c9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,12 +76,12 @@ workflows: filters: tags: only: /.*/ - - release: - context: Github - requires: - - build - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ \ No newline at end of file + #- release: + # context: Github + # requires: + # - build + # filters: + # tags: + # only: /.*/ + # branches: + # ignore: /.*/ \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..85aa21fd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +# 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/checkout@v2 + - + name: Unshallow + run: git fetch --prune --unshallow + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - + name: Import GPG key + id: import_gpg + uses: paultyng/ghaction-import-gpg@v2.1.0 + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..37845af0 --- /dev/null +++ b/.goreleaser.yml @@ -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 is 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 \ No newline at end of file diff --git a/README.md b/README.md index f9fec53a..058766aa 100644 --- a/README.md +++ b/README.md @@ -17,406 +17,12 @@ We fork this project for the following items: ## Installation -[Download a binary](https://github.com/disaster37/terraform-provider-elasticsearch/releases), and put it in a good spot on your system. Then update your `~/.terraformrc` to refer to the binary: +[Go to terraform registry](https://registry.terraform.io/providers/disaster37/elasticsearch/latest) -```hcl -providers { - elasticsearch = "/path/to/terraform-provider-elasticsearch" -} -``` - -See [the docs for more information](https://www.terraform.io/docs/plugins/basics.html). - -## Usage - -### Provider - -The Elasticsearch provider is used to interact with the -resources supported by Elasticsearch. The provider needs -to be configured with an endpoint URL before it can be used. - -***Sample:*** -```tf -provider "elasticsearch" { - urls = "http://elastic.company.com:9200" - username = "elastic" - password = "changeme" -} -``` - -***The following arguments are supported:*** -- **urls**: (required) The list of endpoint Elasticsearch URL, separated by comma. -- **username**: (optional) The username to connect on it. -- **password**: (optional) The password to connect on it. -- **insecure**: (optional) To disable the certificate check. -- **cacert_file**: (optional) The CA contend to use if you use custom PKI. -- **retry**: (optional) The number of time you should to retry connexion befaore exist with error. Default to `6`. -- **wait_before_retry**: (optional) The number of time in second we wait before each connexion retry. Default to `10`. - -___ - -### Role resource - -This resource permit to manage role in Elasticsearch. -You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html - -***Supported Elasticsearch version:*** - - v6 - - v7 - -***Sample:*** -```tf -resource elasticsearch_role "test" { - name = "terraform-test" - indices { - names = ["logstash-*"] - privileges = ["read"] - } - indices { - names = ["logstash-*"] - privileges = ["read2"] - } - cluster = ["all"] -} -``` - -***The following arguments are supported:*** - - **name**: (required) The role name to create - - **cluster**: (optional) A list of cluster privileges. These privileges define the cluster level actions that users with this role are able to execute. - - **run_as**: (optional) A list of users that the owners of this role can impersonate. - - **global**: (optional) A string as JSON object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. - - **metadata**: (optional) A string as JSON object meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. - - **indices**: (optional) A list of indices permissions entries. Look the indice object below. - - **applications**: (optional) A list of application privilege entries. Look the application object below. - - -***Indice object***: - - **names**: (required) A list of indices (or index name patterns) to which the permissions in this entry apply. - - **privileges**: (required) A list of The index level privileges that the owners of the role have on the specified indices. - - **query**: (optional) A search query that defines the documents the owners of the role have read access to. A document within the specified indices must match this query in order for it to be accessible by the owners of the role. It's a string or a string as JSON object. - - **field_security**: (optional) The document fields that the owners of the role have read access to. It's a string as JSON object - -***Application object***: - - **application**: (required) The name of the application to which this entry applies. - - **privileges**: (optional) A list of strings, where each element is the name of an application privilege or action. - - **resources**: (optional) A list resources to which the privileges are applied. - -___ - -### Role mapping resource - -This resource permit to manage role mapping ins Elasticsearch. -You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html - -***Supported Elasticsearch version:*** - - v6 - - v7 - -***Sample***: -```tf -resource elasticsearch_role_mapping "test" { - name = "terraform-test" - enabled = "true" - roles = ["superuser"] - rules = <