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

Provide a default for the autoscaling min/max resource #477

Merged
merged 2 commits into from
Apr 28, 2022

Conversation

tobio
Copy link
Member

@tobio tobio commented Apr 28, 2022

Description

This fixes an issue when specifying an autoscaling min/max when there is no corresponding min/max defined in the deployment template.

We're unable to specify a default in the Terraform schema since the resource attributes are Computed. Instead we define a default in code.

Related Issues

Fixes #401

Motivation and Context

How Has This Been Tested?

Unit tests

Manually with:

resource "ec_deployment" "staging" {
  region                 = "eu-west-1"
  deployment_template_id = "aws-storage-optimized"
  version = "7.17.3"

  elasticsearch {
    topology {
      id         = "hot_content"
      size       = "2g"
      zone_count = 3

      autoscaling {
        max_size = "8g"
      }
    }

    topology {
      id         = "warm"
      size       = "2g"
      zone_count = 2

      autoscaling {
        max_size = "15g"
        min_size = "4g"
      }
    }
  }
}

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improves code quality but has no user-facing effect)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation

Readiness Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

This fixes an issue when specifying an autoscaling min/max when there is no corresponding min/max defined in the deployment template
@tobio tobio added the bug Something isn't working label Apr 28, 2022
@tobio tobio requested a review from a team as a code owner April 28, 2022 11:28
@tobio tobio self-assigned this Apr 28, 2022
@@ -260,6 +239,33 @@ func expandEsTopology(raw interface{}, topologies []*models.ElasticsearchCluster
return res, nil
}

func expandAutoscalingDimension(autoscale map[string]interface{}, model *models.TopologySize, dimension string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be worth placing a short comment on why we need this method

Copy link
Contributor

@mieciu mieciu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit about the comment, but that's definitely good to go as it is 👍

@tobio tobio merged commit f715bbe into master Apr 28, 2022
@tobio tobio deleted the default-autoscaling-dimension-resource branch April 28, 2022 20:26
tobio added a commit that referenced this pull request May 10, 2022
* 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
tobio added a commit that referenced this pull request May 10, 2022
* 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
tobio added a commit that referenced this pull request May 10, 2022
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants