Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment/topologies map #578

Draft
wants to merge 113 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
0627d93
Introduce mux and port the provider to v6.
dimuon Sep 6, 2022
2213f86
Update required version of CLI in examples
dimuon Sep 6, 2022
cf373db
Increase TF verson in github workflow
dimuon Sep 6, 2022
043bbe7
Merge pull request #1 from dimuon/feature/530/ec-deployment
dimuon Sep 7, 2022
2194ad3
Migrate data sources to terraform-provider-framework
pascal-hofmann Aug 31, 2022
1c61d77
Merge pull request #3 from dimuon/feature/530/port-datasources
dimuon Sep 8, 2022
a5de6e9
Migrate resource ec_deployment_traffic_filter_association to terrafor…
dimuon Sep 7, 2022
b7c8e23
Merge pull request #5 from dimuon/feature/530/ec-trafficfilterassoc-only
dimuon Sep 15, 2022
8a79970
Update to terraform-plugin-framework 0.12 and fix import order
pascal-hofmann Sep 15, 2022
6136a1c
Merge pull request #6 from dimuon/feature/530/terraform-plugin-framew…
dimuon Sep 15, 2022
c197f28
Migrate resource ec_deployment_traffic_filter to terraform-provider-f…
pascal-hofmann Sep 18, 2022
c4aebde
Merge pull request #8 from dimuon/feature/530/trafficfilterresource
dimuon Sep 21, 2022
2084e39
Use blocks and ListNestedAttributes for nested schemas in datasources
pascal-hofmann Sep 21, 2022
993d47d
Migrate resource ec_deployment_elasticsearch_keystore to terraform-pl…
pascal-hofmann Sep 23, 2022
b00e28a
Update dependencies and remove external provider workaround from migr…
pascal-hofmann Sep 23, 2022
07aecc1
Merge pull request #11 from dimuon/update-dependencies
dimuon Sep 23, 2022
f310127
Migrate resource ec_deployment_extension to terraform-plugin-framewor…
pascal-hofmann Oct 18, 2022
320fb77
Feature/530/migrate to plugin framework (#2)
dimuon Dec 7, 2022
40f4e5d
skip acceptance tests for checking upgrade from 0.4.1
dimuon Dec 7, 2022
9d7c37b
Merge remote-tracking branch 'upstream/master' into feature/530/migra…
dimuon Dec 7, 2022
0f9eab6
remove leftovers that came after 0.4.1
dimuon Dec 7, 2022
a52f732
update go.mod
dimuon Dec 7, 2022
548a37b
Update changelog
dimuon Dec 7, 2022
50623f9
address PR comments in README
dimuon Dec 7, 2022
e244094
remove obsolete space
dimuon Dec 7, 2022
58b16d5
Address PR comments in provider_config.go
dimuon Dec 13, 2022
51f1eaa
Improve default_value plan modifier
dimuon Dec 13, 2022
d449931
remove obsolete var
dimuon Dec 13, 2022
b51e74a
improve schemas
dimuon Dec 13, 2022
34daf0f
remove obsolete code
dimuon Dec 14, 2022
dd0508b
remove incorrect comment
dimuon Dec 14, 2022
947e8b2
remove obsolete var
dimuon Dec 14, 2022
dfd6060
address PR comments
dimuon Dec 14, 2022
7f676f5
Remove obsolete function
dimuon Dec 19, 2022
345a341
Move provider data to an anonymous struct
dimuon Dec 20, 2022
bd05967
unit test for provider Config
dimuon Dec 20, 2022
f90f2c8
improve provider tests + address PR comments
dimuon Dec 21, 2022
b0bda3b
Refactor provider + address PR comments
dimuon Dec 21, 2022
99b3745
address PR comments
dimuon Dec 21, 2022
8c396b2
use plan modifiers from Hashicorp where possible
dimuon Dec 21, 2022
0df8f99
refactor ExtractEndpointsTF
dimuon Dec 21, 2022
f194f76
conversion funcs renaming
dimuon Dec 21, 2022
0675863
remove obsolete comment
dimuon Dec 21, 2022
4fa42b2
Apply suggestions from code review
dimuon Dec 22, 2022
0556078
remove obsolete comments in v1 schemas
dimuon Dec 22, 2022
7277f41
split apm and deployment in deploymentresource to read and payload files
dimuon Dec 22, 2022
d992a89
renaming and removing obsolete code
dimuon Dec 22, 2022
8cf3c54
split elasticsearch to read and payload files
dimuon Dec 22, 2022
c8ad85e
split enterprise_search files to read and payload
dimuon Dec 22, 2022
f323cf1
split integrations_server files to read and payload
dimuon Dec 22, 2022
a312dca
split kibana files to read and payload
dimuon Dec 22, 2022
3000ee3
split observability files to read and payload
dimuon Dec 22, 2022
4ae31c9
fix description
dimuon Dec 22, 2022
a624e68
renaming and removing obsolete code
dimuon Dec 22, 2022
4edcc2d
Apply suggestions from code review
dimuon Dec 22, 2022
39a1c43
endpoints extractions: use the converter func instead of the one from…
dimuon Dec 22, 2022
ebc05cf
moving code around and some renaming
dimuon Dec 22, 2022
71c9660
fix lint errors
dimuon Dec 22, 2022
cca7a75
renaming
dimuon Dec 22, 2022
42a7c92
renaming and obsolete code removing
dimuon Dec 22, 2022
2d108e5
renaming according to PR comments
dimuon Dec 27, 2022
b460efb
renaming + incorrect comment removal
dimuon Dec 27, 2022
b1862d4
fix unit test
dimuon Dec 27, 2022
8c938b1
convert 'elasticsearch' 'autoscale' attribute to bool type
dimuon Dec 27, 2022
395a3bc
remove TODOs for DiffSupressFunc
dimuon Dec 27, 2022
894bdb5
unit test for handling traffic rules
dimuon Dec 27, 2022
6a92321
move files from utils to dedicated resource packages
dimuon Dec 28, 2022
a2ce9d4
unit tests for UseNodeRoles
dimuon Dec 28, 2022
663167f
(WIP) Bring back logic of migrating node_types to node_roles
dimuon Dec 30, 2022
f0ca456
Improve node_type detection
dimuon Jan 3, 2023
8f14a40
improve and rearrange node_types plan modifier
dimuon Jan 4, 2023
0e50ae7
enable test for UseNodeRoles + minor refactoring
dimuon Jan 4, 2023
e11db61
unit tests for node_types and node_roles modifiers
dimuon Jan 4, 2023
4800d9d
renaming + obsolete code removal
dimuon Jan 5, 2023
3b4e53c
unit test for topology plan modifer + some refactoring
dimuon Jan 5, 2023
8d90524
deploymentdatasource: change flatteners to return the result
dimuon Jan 11, 2023
7400f7c
remove obsolete utility funcs
dimuon Jan 11, 2023
c0924dd
renaming local var
dimuon Jan 11, 2023
6c507cf
fix converion to attr.Value in deploymentdatasource
dimuon Jan 12, 2023
fc8a6cf
deploymentresource read - remove conversion to TF types
dimuon Jan 13, 2023
8e8a85c
Fix description an error messages. Remove obsolete TODO
dimuon Jan 13, 2023
07a5908
minor improvements for deploymentresource tests
dimuon Jan 13, 2023
a36caba
Replace any interface arg with returned type in stackdatasource
dimuon Jan 13, 2023
d1208af
Renaming
dimuon Jan 13, 2023
dda3586
move ResourceKind to util
dimuon Jan 13, 2023
2b07835
Replace any interface arg with returned type in trafficfilterresource
dimuon Jan 13, 2023
b30c207
add missing file
dimuon Jan 13, 2023
42fd243
Update NOTICE
dimuon Jan 13, 2023
ed86516
Merge branch 'master' into feature/530/migrate-to-plugin-framework
dimuon Jan 13, 2023
c60b15c
Update NOTICE
dimuon Jan 13, 2023
d3263ff
Fixing description for Enterprise Search
dimuon Jan 16, 2023
0d104c2
(WIP) use types.Set for topologies (unit tests fails)
dimuon Jan 18, 2023
ef276f8
Update README - add a note for updaint the TF client
dimuon Jan 18, 2023
910ebc0
Fixes for topologies as a set
dimuon Jan 18, 2023
48d04c3
Fix elasticsearch topology description and remove obsolete func
dimuon Jan 18, 2023
3d6835c
Fixes for NullifyUnusedEsTopologies
dimuon Jan 19, 2023
a2d6a62
Fix examples
dimuon Jan 19, 2023
422d45e
Apply suggestions from code review
dimuon Jan 23, 2023
d53e596
makes elasticsearch topology required
dimuon Jan 23, 2023
ef67aa5
Addres PR comments - fix descriptions and scope of definitions
dimuon Jan 23, 2023
2fef8e6
update comment
dimuon Jan 23, 2023
5e31465
fix description
dimuon Jan 24, 2023
75c16c3
remove incorrect comments
dimuon Jan 24, 2023
9422638
(WIP) use map for Elasticsearch topologies
dimuon Jan 24, 2023
e221610
Remove obsolete plan modifier for elasticsearch topology zone_count
dimuon Jan 24, 2023
89760d2
Fix and enable plan modifiers for topology attributes
dimuon Jan 24, 2023
8fc4f66
Merge remote-tracking branch 'origin/feature/530/migrate-to-plugin-fr…
dimuon Jan 25, 2023
82e869c
stop exporting a function
dimuon Jan 25, 2023
53397aa
fix unit tests
dimuon Jan 25, 2023
189d2d9
fix acceptance tests and examples
dimuon Jan 25, 2023
f974720
remove obsolete code
dimuon Jan 25, 2023
2a17c5b
fix errors in acceptance tests
dimuon Jan 26, 2023
b81d334
fix regex expressions in acc tests for pre node_roles
dimuon Feb 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
- name: Install terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: "0.14.x"
terraform_version: "1.x.x"
terraform_wrapper: false

- name: Cache Go Modules
uses: actions/cache@v3
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
# 0.6.0 (Unreleased)
# 0.7.0 (Unreleased)

FEATURES:

* resource/deployment: Utilise the template migration API to build the base update request when changing `deployment_template_id`. This results in more reliable changes between deployment templates. ([#547](https://github.com/elastic/terraform-provider-ec/issues/547))

# 0.6.0 (Unreleased)

FEATURES:

Migration to [TF Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework)

BREAKING CHANGES:

New schema for `ec_deployment`

BUG FIXES:

[#336](https://github.com/elastic/terraform-provider-ec/issues/336)
[#467](https://github.com/elastic/terraform-provider-ec/issues/467)
[#445](https://github.com/elastic/terraform-provider-ec/issues/445)

NOTES

* The migration is based on 0.4.1, so all changes from 0.5.0 are omitted.

* State upgrade is not yet implemented for `ec_deployment`.
The recommended way to proceed with existing TF resources is [state import](https://developer.hashicorp.com/terraform/cli/import#state-only).
However, this doesn't import user passwords and secret tokens.

# 0.5.0 (Oct 12, 2022)

FEATURES:
Expand Down
150 changes: 74 additions & 76 deletions NOTICE
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,85 +1,83 @@
terraform-provider-ec
Copyright 2023 Elasticsearch B.V.
Copyright 2022-2023 Elasticsearch B.V.

This product includes software developed at Elasticsearch B.V. and
third-party software developed by the licenses listed below.

=========================================================================

github.com/davecgh/go-spew 0BSD
github.com/agext/levenshtein Apache-2.0
github.com/apparentlymart/go-textseg/v13 Apache-2.0
github.com/elastic/cloud-sdk-go Apache-2.0
github.com/go-logr/logr Apache-2.0
github.com/go-logr/stdr Apache-2.0
github.com/go-openapi/analysis Apache-2.0
github.com/go-openapi/errors Apache-2.0
github.com/go-openapi/jsonpointer Apache-2.0
github.com/go-openapi/jsonreference Apache-2.0
github.com/go-openapi/loads Apache-2.0
github.com/go-openapi/runtime Apache-2.0
github.com/go-openapi/spec Apache-2.0
github.com/go-openapi/strfmt Apache-2.0
github.com/go-openapi/swag Apache-2.0
github.com/go-openapi/validate Apache-2.0
github.com/oklog/run Apache-2.0
github.com/oklog/ulid Apache-2.0
github.com/opentracing/opentracing-go Apache-2.0
go.mongodb.org/mongo-driver Apache-2.0
go.opentelemetry.io/otel/trace Apache-2.0
go.opentelemetry.io/otel Apache-2.0
google.golang.org/appengine Apache-2.0
google.golang.org/genproto Apache-2.0
google.golang.org/grpc Apache-2.0
gopkg.in/yaml.v2 Apache-2.0
gopkg.in/yaml.v3 Apache-2.0
github.com/vmihailenco/msgpack/v4 BSD-2-Clause
github.com/vmihailenco/msgpack BSD-2-Clause
github.com/vmihailenco/tagparser BSD-2-Clause
github.com/puerkitobio/purell BSD-3-Clause
github.com/puerkitobio/urlesc BSD-3-Clause
github.com/golang/protobuf BSD-3-Clause
github.com/google/go-cmp BSD-3-Clause
github.com/pmezard/go-difflib BSD-3-Clause
golang.org/x/crypto BSD-3-Clause
golang.org/x/net BSD-3-Clause
golang.org/x/sys BSD-3-Clause
golang.org/x/text BSD-3-Clause
google.golang.org/protobuf BSD-3-Clause
github.com/apparentlymart/go-cidr MIT
github.com/asaskevich/govalidator MIT
github.com/blang/semver/v4 MIT
github.com/fatih/color MIT
github.com/hashicorp/go-cty MIT
github.com/hashicorp/go-hclog MIT
github.com/josharian/intern MIT
github.com/mailru/easyjson MIT
github.com/mattn/go-colorable MIT
github.com/mattn/go-isatty MIT
github.com/mitchellh/copystructure MIT
github.com/mitchellh/go-testing-interface MIT
github.com/mitchellh/go-wordwrap MIT
github.com/mitchellh/mapstructure MIT
github.com/mitchellh/reflectwalk MIT
github.com/stretchr/testify MIT
github.com/zclconf/go-cty MIT
github.com/hashicorp/go-checkpoint MPL-2.0
github.com/hashicorp/go-cleanhttp MPL-2.0
github.com/hashicorp/go-multierror MPL-2.0
github.com/hashicorp/hc-install MPL-2.0
github.com/hashicorp/hcl/v2 MPL-2.0
github.com/hashicorp/logutils MPL-2.0
github.com/hashicorp/terraform-json MPL-2.0
github.com/hashicorp/terraform-plugin-log MPL-2.0
github.com/hashicorp/terraform-plugin-sdk/v2 MPL-2.0
github.com/hashicorp/yamux MPL-2.0
github.com/hashicorp/errwrap MPL-2.0-no-copyleft-exception
github.com/hashicorp/go-plugin MPL-2.0-no-copyleft-exception
github.com/hashicorp/go-uuid MPL-2.0-no-copyleft-exception
github.com/hashicorp/go-version MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-exec MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-plugin-go MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-registry-address MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-svchost MPL-2.0-no-copyleft-exception
github.com/davecgh/go-spew 0BSD
github.com/agext/levenshtein Apache-2.0
github.com/apparentlymart/go-textseg/v13 Apache-2.0
github.com/elastic/cloud-sdk-go Apache-2.0
github.com/go-openapi/analysis Apache-2.0
github.com/go-openapi/errors Apache-2.0
github.com/go-openapi/jsonpointer Apache-2.0
github.com/go-openapi/jsonreference Apache-2.0
github.com/go-openapi/loads Apache-2.0
github.com/go-openapi/runtime Apache-2.0
github.com/go-openapi/spec Apache-2.0
github.com/go-openapi/strfmt Apache-2.0
github.com/go-openapi/swag Apache-2.0
github.com/go-openapi/validate Apache-2.0
github.com/oklog/run Apache-2.0
github.com/oklog/ulid Apache-2.0
github.com/opentracing/opentracing-go Apache-2.0
go.mongodb.org/mongo-driver Apache-2.0
google.golang.org/appengine Apache-2.0
google.golang.org/genproto Apache-2.0
google.golang.org/grpc Apache-2.0
gopkg.in/yaml.v2 Apache-2.0
gopkg.in/yaml.v3 Apache-2.0
github.com/vmihailenco/msgpack/v4 BSD-2-Clause
github.com/vmihailenco/msgpack BSD-2-Clause
github.com/vmihailenco/tagparser BSD-2-Clause
github.com/golang/protobuf BSD-3-Clause
github.com/google/go-cmp BSD-3-Clause
github.com/pmezard/go-difflib BSD-3-Clause
golang.org/x/crypto BSD-3-Clause
golang.org/x/exp BSD-3-Clause
golang.org/x/net BSD-3-Clause
golang.org/x/sys BSD-3-Clause
golang.org/x/text BSD-3-Clause
google.golang.org/protobuf BSD-3-Clause
github.com/apparentlymart/go-cidr MIT
github.com/asaskevich/govalidator MIT
github.com/blang/semver/v4 MIT
github.com/blang/semver MIT
github.com/fatih/color MIT
github.com/hashicorp/go-cty MIT
github.com/hashicorp/go-hclog MIT
github.com/josharian/intern MIT
github.com/mailru/easyjson MIT
github.com/mattn/go-colorable MIT
github.com/mattn/go-isatty MIT
github.com/mitchellh/copystructure MIT
github.com/mitchellh/go-testing-interface MIT
github.com/mitchellh/go-wordwrap MIT
github.com/mitchellh/mapstructure MIT
github.com/mitchellh/reflectwalk MIT
github.com/stretchr/testify MIT
github.com/zclconf/go-cty MIT
github.com/hashicorp/errwrap MPL-2.0
github.com/hashicorp/go-checkpoint MPL-2.0
github.com/hashicorp/go-plugin MPL-2.0
github.com/hashicorp/go-uuid MPL-2.0
github.com/hashicorp/hc-install MPL-2.0
github.com/hashicorp/terraform-exec MPL-2.0
github.com/hashicorp/terraform-json MPL-2.0
github.com/hashicorp/terraform-plugin-framework-validators MPL-2.0
github.com/hashicorp/terraform-plugin-sdk/v2 MPL-2.0
github.com/hashicorp/terraform-svchost MPL-2.0
github.com/hashicorp/go-cleanhttp MPL-2.0-no-copyleft-exception
github.com/hashicorp/go-multierror MPL-2.0-no-copyleft-exception
github.com/hashicorp/go-version MPL-2.0-no-copyleft-exception
github.com/hashicorp/hcl/v2 MPL-2.0-no-copyleft-exception
github.com/hashicorp/logutils MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-plugin-framework MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-plugin-go MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-plugin-log MPL-2.0-no-copyleft-exception
github.com/hashicorp/terraform-registry-address MPL-2.0-no-copyleft-exception
github.com/hashicorp/yamux MPL-2.0-no-copyleft-exception

=========================================================================
130 changes: 128 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ resource "ec_deployment" "example_minimal" {
deployment_template_id = "aws-io-optimized-v2"

# Use the deployment template defaults
elasticsearch {}
elasticsearch = {
hot = {
autoscaling = {}
}
}

kibana {}
kibana = {
topology = {}
}
}
```

Expand Down Expand Up @@ -114,3 +120,123 @@ $ export EC_API_KEY="<apikey value>"
```

After doing so, you can navigate to any of our examples in `./examples` and try one.

### Moving to TF Framework and schema change for `ec_deployment` resource.

v0.6.0 contains migration to [TF Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework) and intoduces new schema for `ec_deployment` resource:

- switching to attributes syntax instead of blocks for almost all definitions that used to be blocks. It means that, for example, a definition like `elasticsearch {...}` has to be changed to `elasticsearch = {...}`, e.g.

```hcl
resource "ec_deployment" "defaults" {
name = "example"
region = "us-east-1"
version = data.ec_stack.latest.version
deployment_template_id = "aws-io-optimized-v2"

elasticsearch = {
hot = {
autoscaling = {}
}
}

kibana = {
topology = {}
}

enterprise_search = {
zone_count = 1
}
}
```

- `topology` attribute of `elasticsearch` is replaced with a number of dedicated attributes, one per tier, e.g.

```
elasticsearch {
topology {
id = "hot_content"
size = "1g"
autoscaling {
max_size = "8g"
}
}
topology {
id = "warm"
size = "2g"
autoscaling {
max_size = "15g"
}
}
}
```

has to be converted to

```
elasticsearch = {
hot = {
size = "1g"
autoscaling = {
max_size = "8g"
}
}

warm = {
size = "2g"
autoscaling = {
max_size = "15g"
}
}
}

```

- due to some existing limitations of TF, nested attributes that are nested inside other nested attributes cannot be `Computed`. It means that all such attributes have to be mentioned in configurations even if they are empty. E.g., a definition of `elasticsearch` has to include all topology elements (tiers) that have non-zero size or can be scaled up (if autoscaling is enabled) in the corresponding template. For example, the simplest definition of `elasticsearch` for `aws-io-optimized-v2` template is

```hcl
resource "ec_deployment" "defaults" {
name = "example"
region = "us-east-1"
version = data.ec_stack.latest.version
deployment_template_id = "aws-io-optimized-v2"

elasticsearch = {
hot = {
autoscaling = {}
}
}
}
```

Please note that the snippet explicitly mentions `hot` tier with `autoscaling` attribute even despite the fact that they are empty.

- a lot of attributes that used to be collections (e.g. lists and sets) are converted to sigletons, e.g. `elasticsearch`, `apm`, `kibana`, `enterprise_search`, `observability`, `topology`, `autoscaling`, etc. Please note that, generally, users are not expected to make any change to their existing configuration to address this particular change (besides moving from block to attribute syntax). All these components used to exist in single instances, so the change is mostly syntactical, taking into account the switch to attributes instead of blocks (otherwise if we kept list for configs, `config {}` had to be rewritten in `config = [{}]` with the move to the attribute syntax). However this change is a breaking one from the schema perspective and requires state upgrade for existing resources that is performed by TF (by calling the provider's API).

- [`strategy` attribute](https://registry.terraform.io/providers/elastic/ec/latest/docs/resources/ec_deployment#strategy) is converted to string with the same set of values that was used for its `type` attribute previously;

- switching to TF protocol 6. From user perspective it should not require any change in their existing configurations.

#### Migration guide.

The schema modifications means that a current TF state cannot work as is with the provider version 0.6.0 and higher.

There are 2 ways to tackle this

- import existing resource using deployment ID, e.g `terraform import 'ec_deployment.test' <deployment_id>`
- state upgrade that is performed by TF by calling the provider's API so no action is required from user perspective

Currently the state upgrade functionality is still in development so importing existing resources is the recommended way to deal with existing TF states.
Please mind the fact that state import doesn't import user passwords and secret tokens that can be the case if your TF modules make use of them.
State upgrade doesn't have this limitation.

#### Known issues.

For the migrated version (0.6.0 or higher), `terraform plan` output can contain more changes comparing to the older versions of the provider (that use TF SDK).
This happens because TF Framework treats all `computed` attributes as `unknown` (known after apply) once configuration changes.
`ec_deployment` schema contains quite a few of such attributes, so `terraform plan`'s output can be quite big for the resource due to the mentioned reason.
However, it doesn't mean that all attributes that marked as `unknown` in the plan will get new values after apply.
To mitigitate the problem, the provider uses plan modifiers that is a recommended way to reduce plan output.
However, currently plan modifiers don't cover all the `computed` attributes.

Please make sure to update to the latest TF client version.
2 changes: 1 addition & 1 deletion build/Makefile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARCH_GORELEASER:=$(shell $(PWD)/scripts/uname_arch_goreleaser.sh)
VERSION_DIR:=$(GOBIN)/versions

VERSION_GOLICENSER:=v0.3.0
VERSION_GOLANGCILINT:=v1.49.0
VERSION_GOLANGCILINT:=v1.50.0
VERSION_GORELEASER:=v1.2.5
VERSION_GOCHANGELOG:=v0.0.0-20201005170154-56335215ce3a
VERSION_VERSIONBUMP:=v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions build/Makefile.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SWEEP_DIR ?= $(TEST_ACC)
SWEEP_CI_RUN_FILTER ?= ec_deployments
TEST ?= ./...
TEST_COUNT ?= 1
TESTUNITARGS ?= -timeout 10s -p 4 -race -cover -coverprofile=reports/c.out
TESTUNITARGS ?= -timeout 10m -race -cover -coverprofile=reports/c.out
TEST_ACC ?= github.com/elastic/terraform-provider-ec/ec/acc
TEST_NAME ?= TestAcc
TEST_ACC_PARALLEL = 6
Expand All @@ -26,7 +26,7 @@ unit: _report_path
tests: unit

.PHONY: testacc
## Runs the Terraform acceptance tests. Use TEST_NAME, TESTARGS, TEST_COUNT and TEST_ACC_PARALLEL to control execution.
## Runs the Terraform acceptance tests. Use TEST_NAME, TESTARGS, TEST_COUNT to control execution.
testacc:
@ echo "-> Running terraform acceptance tests..."
@ TF_ACC=1 go test $(TEST_ACC) -v -count $(TEST_COUNT) -parallel $(TEST_ACC_PARALLEL) $(TESTARGS) -timeout 120m -run $(TEST_NAME)
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/ec_stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |-
Retrieves information about an Elastic Cloud stack.
---

# Data Source: ec_deployment
# Data Source: ec_stack

Use this data source to retrieve information about an existing Elastic Cloud stack.

Expand Down
Loading