Skip to content

Commit af986bd

Browse files
tobioluigibkrenovate[bot]renovate-botelasticcloudclients
authored
Backport 0.4.1 (#483)
* feat: 429 add debug mode (#430) * feat: 429 add debug mode * clean up * Add const comment * fix: make build gcflags issue * fix(deps): update module github.com/stretchr/testify to v1.7.1 (#456) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update actions/checkout action to v3 (#451) Co-authored-by: Renovate Bot <[email protected]> * Update CHANGELOG.md and NOTICE * chore(deps): update endbug/add-and-commit action to v9 (#454) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update actions/setup-go action to v3 (#448) Co-authored-by: Renovate Bot <[email protected]> * fix(deps): update module github.com/go-openapi/runtime to v0.23.2 (#452) Co-authored-by: Renovate Bot <[email protected]> * Update CHANGELOG.md and NOTICE * chore(deps): update actions/cache action to v3 (#458) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update peterjgrainger/action-create-branch action to v2.2.0 (#461) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update hashicorp/setup-terraform action to v2 (#470) Co-authored-by: Renovate Bot <[email protected]> * Update CHANGELOG.md and NOTICE * Include a note in the import docs mentioning that the credentials will not be available. (#464) * fix(deps): update module github.com/hashicorp/terraform-plugin-sdk/v2 to v2.11.0 (#453) * fix(deps): update module github.com/hashicorp/terraform-plugin-sdk/v2 to v2.11.0 * Move debug mode to ServeOpts Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Toby Brain <[email protected]> * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * Allow zero sized topology elements when autoscaling is enabled (#472) * Allow zero sized topology elements when autoscaling is enabled * Fix acceptance test * fix(deps): update module github.com/hashicorp/terraform-plugin-sdk/v2 to v2.14.0 (#475) Co-authored-by: Renovate Bot <[email protected]> * Provide a default for the autoscaling min/max resource (#477) * Provide a default for the autoscaling min/max resource This fixes an issue when specifying an autoscaling min/max when there is no corresponding min/max defined in the deployment template * PR feedback * fix(deps): update module github.com/elastic/cloud-sdk-go to v1.9.0 (#480) Co-authored-by: Renovate Bot <[email protected]> * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * fix(deps): update module github.com/go-openapi/runtime to v0.24.0 (#457) Co-authored-by: Renovate Bot <[email protected]> * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * Update CHANGELOG.md and NOTICE * fix(deps): update module github.com/hashicorp/terraform-plugin-sdk/v2 to v2.15.0 (#481) Co-authored-by: Renovate Bot <[email protected]> * Update CHANGELOG.md and NOTICE * Fixes arguments for add-and-commit (#479) * Fixes arguments for add-and-commit These were changed in v8. https://github.com/EndBug/add-and-commit/blob/main/CHANGELOG.md#800---2022-01-20 * Change branch property on the minor bump. * Fetch full repo history when checking out. make minor inspects the current git tags before bumping. Without fetching those tags, the task fails. * Add changelog * Download the Terraform CLI for acceptance tests This should be temporary, the automated download is currently failing due to an unexpected content-type on the response Co-authored-by: luigibk <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: elasticcloudclients <[email protected]>
1 parent b64c011 commit af986bd

20 files changed

+421
-706
lines changed

.changelog/430.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
main: Adds debug mode. Instructions for debugging the provider can be found in the [CONTRIBUTING](https://github.com/elastic/terraform-provider-ec/blob/master/CONTRIBUTING.md#debugging) docs.
3+
```

.changelog/472.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```release-note:bug
2+
Allow zero sized topology elements when autoscaling is enabled. Previously, including an ML topology block would result in a persistent diff loop when the underlying ML tier remained disabled by autoscaling (i.e no ML jobs were enabled).
3+
```
4+
5+
```release-note:breaking-change
6+
To support unsized topology elements when autoscaling is enabled, we now include all potentially sized topology elements in the `ec_deployment` state.
7+
When autoscaling is enabled, we now require that all autoscaleable topology elements be defined in the `elasticsearch` block of an `ec_deployment` resource.
8+
If a topology element is not defined, Terraform will report a persistent diff during a plan/apply.
9+
```

.changelog/477.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```release-note:bug
2+
Provide a default for autoscaling min_size_resource and max_size_resource attributes. This avoids an API error when there is no corresponding value in the deployment template.

.github/workflows/branch.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v2
20+
uses: actions/setup-go@v3
2121
with:
2222
go-version: 1.17
2323
id: go
@@ -35,18 +35,18 @@ jobs:
3535
echo ::set-output name=BRANCH::$(echo ${BRANCH} | cut -d '.' -f1-2 | tr -d 'v')
3636
3737
- name: Create a github branch
38-
uses: peterjgrainger/action-create-branch@v2.1.0
38+
uses: peterjgrainger/action-create-branch@v2.2.0
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
4141
with:
4242
branch: ${{ steps.get_branch.outputs.BRANCH }}
4343

4444
- name: Commit changes to the minor branch
45-
uses: EndBug/add-and-commit@v8
45+
uses: EndBug/add-and-commit@v9
4646
with:
4747
default_author: user_info
4848
message: 'Update patch version'
49-
branch: ${{ steps.get_branch.outputs.BRANCH }}
49+
new_branch: ${{ steps.get_branch.outputs.BRANCH }}
5050
author_name: elasticcloudclients
5151
author_email: [email protected]
5252

@@ -55,13 +55,14 @@ jobs:
5555
runs-on: ubuntu-latest
5656
steps:
5757
- name: Checkout
58-
uses: actions/checkout@v2
58+
uses: actions/checkout@v3
5959
with:
6060
ref: master
6161
token: ${{ secrets.GH_TOKEN }}
62+
fetch-depth: 0
6263

6364
- name: Set up Go
64-
uses: actions/setup-go@v2
65+
uses: actions/setup-go@v3
6566
with:
6667
go-version: 1.17
6768
id: go
@@ -70,10 +71,10 @@ jobs:
7071
run: make minor; git diff
7172

7273
- name: Commit changes to main
73-
uses: EndBug/add-and-commit@v8
74+
uses: EndBug/add-and-commit@v9
7475
with:
7576
default_author: user_info
7677
message: 'Update minor version'
77-
branch: master
78+
new_branch: master
7879
author_name: elasticcloudclients
7980
author_email: [email protected]

.github/workflows/changelog_generation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
GenerateChangelog:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
with:
1414
token: ${{ secrets.GH_TOKEN }}
1515
fetch-depth: 0
1616

1717
- name: Set up Go
18-
uses: actions/setup-go@v2
18+
uses: actions/setup-go@v3
1919
with:
2020
go-version: 1.17
2121
id: go

.github/workflows/go.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ jobs:
1010
steps:
1111

1212
- name: Set up Go
13-
uses: actions/setup-go@v2
13+
uses: actions/setup-go@v3
1414
with:
1515
go-version: 1.17
1616
id: go
1717

1818
- name: Check out code into the Go module directory
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020

2121
- name: Install terraform
22-
uses: hashicorp/setup-terraform@v1
22+
uses: hashicorp/setup-terraform@v2
2323
with:
2424
terraform_version: "0.14.x"
2525

2626
- name: Cache Go Modules
27-
uses: actions/cache@v2
27+
uses: actions/cache@v3
2828
with:
2929
path: ~/go/pkg/mod
3030
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,25 @@ $ make build
127127
```
128128

129129
You can also use the `make install` target if you wish. This target will install the binary and move it to your Terraform plugin location.
130+
131+
### Debugging
132+
133+
This provider supports debugger-based debugging as described in the related [Terraform SDK documentation](https://www.terraform.io/plugin/sdkv2/debugging#debugger-based-debugging). To build a provider with the necessary Go compiler flags run:
134+
135+
```console
136+
$ make build GCFLAGS='-gcflags="all=-N -l"'
137+
```
138+
139+
To run the provider and connect it to your debugger run:
140+
141+
```console
142+
dlv --listen=:60324 --headless=true --api-version=2 --accept-multiclient exec ./bin/terraform-provider-ec -- --debug
143+
```
144+
145+
Connect your debugger using port 60234 as target. The provider should output a line containing the following variable:
146+
147+
```console
148+
TF_REATTACH_PROVIDERS='{"registry.terraform.io/elastic/ec":{"Protocol":"grpc","ProtocolVersion":5,"Pid":13197,"Test":true,"Addr":{"Network":"unix","String":"/tmp/plugin977285207"}}}'
149+
```
150+
151+
which you can export or use to prefix every Terraform command. If that variable is not printed as soon as you connect your debugger, pausing execution and restarting it might do the trick.

build/Makefile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ generate: gen
1919
## Builds the source code and saves the binary to bin/terraform-provider-ec.
2020
.PHONY: build
2121
build: gen
22-
@ echo "-> Building binary in $(BINARY_LOCATION)..."
23-
@ go build -o $(BINARY_LOCATION) .
22+
@ echo "-> Building binary with GCFLAGS=$(GCFLAGS) in $(BINARY_LOCATION)..."
23+
@ go build $(GCFLAGS) -o $(BINARY_LOCATION) .
2424

2525
## Builds the source code and moves the binary to the user's terraform plugin location.
2626
.PHONY: install

build/Makefile.test

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ TESTUNITARGS ?= -timeout 10s -p 4 -race -cover -coverprofile=reports/c.out
77
TEST_ACC ?= github.com/elastic/terraform-provider-ec/ec/acc
88
TEST_NAME ?= TestAcc
99
TEST_ACC_PARALLEL = 6
10+
TERRAFORM_ACC_VERSION = 1.1.9
1011

1112
REPORT_PATH ?= ./reports
1213

@@ -41,8 +42,13 @@ endif
4142
@ go test $(SWEEP_DIR) -v -sweep=$(SWEEP) $(SWEEPARGS) -timeout 60m
4243

4344
.PHONY: testacc-ci
44-
testacc-ci:
45-
@ EC_API_KEY=$(shell cat .ci/.apikey) $(MAKE) testacc
45+
testacc-ci: terraform
46+
@ TF_ACC_TERRAFORM_PATH=$(CURDIR)/terraform EC_API_KEY=$(shell cat .ci/.apikey) $(MAKE) testacc
47+
48+
terraform:
49+
@ apt update && apt install unzip
50+
@ curl -o terraform.zip https://releases.hashicorp.com/terraform/$(TERRAFORM_ACC_VERSION)/terraform_$(TERRAFORM_ACC_VERSION)_linux_amd64.zip
51+
@ unzip terraform.zip
4652

4753
.PHONY: sweep-ci
4854
sweep-ci:

docs/resources/ec_deployment.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ The required `elasticsearch` block supports the following arguments:
232232

233233
* `topology` - (Optional) Can be set multiple times to compose complex topologies.
234234
* `ref_id` - (Optional) Can be set on the Elasticsearch resource. The default value `main-elasticsearch` is recommended.
235-
* `config` (Optional) Elasticsearch settings applied to all topologies unless overridden in the `topology` element.
235+
* `config` (Optional) Elasticsearch settings applied to all topologies unless overridden in the `topology` element.
236236
* `remote_cluster` (Optional) Elasticsearch remote clusters to configure for the Elasticsearch resource. Can be set multiple times.
237237
* `snapshot_source` (Optional) Restores data from a snapshot of another deployment.
238238
* `extension` (Optional) Custom Elasticsearch bundles or plugins. Can be set multiple times.
@@ -335,7 +335,7 @@ The optional `kibana` block supports the following arguments:
335335
* `topology` - (Optional) Can be set multiple times to compose complex topologies.
336336
* `elasticsearch_cluster_ref_id` - (Optional) This field references the `ref_id` of the deployment Elasticsearch cluster. The default value `main-elasticsearch` is recommended.
337337
* `ref_id` - (Optional) Can be set on the Kibana resource. The default value `main-kibana` is recommended.
338-
* `config` (Optional) Kibana settings applied to all topologies unless overridden in the `topology` element.
338+
* `config` (Optional) Kibana settings applied to all topologies unless overridden in the `topology` element.
339339

340340
##### Topology
341341

@@ -362,7 +362,7 @@ The optional `integrations_server` block supports the following arguments:
362362
* `topology` - (Optional) Can be set multiple times to compose complex topologies.
363363
* `elasticsearch_cluster_ref_id` - (Optional) This field references the `ref_id` of the deployment Elasticsearch cluster. The default value `main-elasticsearch` is recommended.
364364
* `ref_id` - (Optional) Can be set on the Integrations Server resource. The default value `main-integrations_server` is recommended.
365-
* `config` (Optional) Integrations Server settings applied to all topologies unless overridden in the `topology` element.
365+
* `config` (Optional) Integrations Server settings applied to all topologies unless overridden in the `topology` element.
366366

367367
##### Topology
368368

@@ -386,7 +386,7 @@ The optional `apm` block supports the following arguments:
386386
* `topology` - (Optional) Can be set multiple times to compose complex topologies.
387387
* `elasticsearch_cluster_ref_id` - (Optional) This field references the `ref_id` of the deployment Elasticsearch cluster. The default value `main-elasticsearch` is recommended.
388388
* `ref_id` - (Optional) Can be set on the APM resource. The default value `main-apm` is recommended.
389-
* `config` (Optional) APM settings applied to all topologies unless overridden in the `topology` element.
389+
* `config` (Optional) APM settings applied to all topologies unless overridden in the `topology` element.
390390

391391
##### Topology
392392

@@ -414,7 +414,7 @@ The optional `enterprise_search` block supports the following arguments:
414414
* `topology` - (Optional) Can be set multiple times to compose complex topologies.
415415
* `elasticsearch_cluster_ref_id` - (Optional) This field references the `ref_id` of the deployment Elasticsearch cluster. The default value `main-elasticsearch` is recommended.
416416
* `ref_id` - (Optional) Can be set on the Enterprise Search resource. The default value `main-enterprise_search` is recommended.
417-
* `config` (Optional) Enterprise Search settings applied to all topologies unless overridden in the `topology` element.
417+
* `config` (Optional) Enterprise Search settings applied to all topologies unless overridden in the `topology` element.
418418

419419
##### Topology
420420

@@ -488,6 +488,8 @@ In addition to all the arguments above, the following attributes are exported:
488488

489489
## Import
490490

491+
~> **Note on deployment credentials** The `elastic` user credentials are only available whilst creating a deployment. Importing a deployment will not import the `elasticsearch_username` or `elasticsearch_password` attributes.
492+
491493
~> **Note on legacy (pre-slider) deployments** Importing deployments created prior to the addition of sliders in ECE or ESS, without being migrated to use sliders, is not supported.
492494

493495
~> **Note on pre 6.6.0 deployments** Importing deployments with a version lower than `6.6.0` is not supported.

0 commit comments

Comments
 (0)