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

Use state for unknown for computed attributes which won't change during plan application #677

Merged
merged 21 commits into from
Aug 5, 2023

Conversation

tobio
Copy link
Member

@tobio tobio commented Jul 14, 2023

Description

These values may potentially change throughout a deployment lifecycle, but those changes will be picked up during the refresh phase, updating state prior to computing the plan

These values, when unset, should be 'known' as they are provided in the API response

This PR does not result in completely clean plans due to how traffic filters currently work. I'm not sure there's a straightforward solution there, as the traffic_filter_association resource can lead to traffic filters changing during the course of a plan application. Simply using state for unknown on this attribute leads to TF crashing as a result of an unexpected new value after apply.

I need to bump the TF version used in the acceptance tests here too.

Related Issues

Fixes #599

How Has This Been Tested?

Manually, unit tests

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

…ng plan application

These values may potentially change throughout a deployment lifecycle, but those changes will be picked up during the refresh phase, updating state prior to computing the plan

These values, when unset, should be 'known' as they are provided in the API response
@tobio tobio requested a review from dimuon July 14, 2023 13:49
@tobio tobio requested a review from a team as a code owner July 14, 2023 13:49
@tobio tobio self-assigned this Jul 14, 2023
@@ -44,6 +44,7 @@ func readElasticsearchConfig(in *models.ElasticsearchConfiguration) (*Elasticsea
return &ElasticsearchConfig{}, nil
}

config.Plugins = []string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

It can lead to the inconsistency error if config is empty. Also it's not needed - append can append to nil.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean if TF configuration doesn't have config.

@jamesagarside
Copy link

Hopefully should address elastic/terraform-provider-elasticstack#370

@@ -44,6 +44,7 @@ func readElasticsearchConfig(in *models.ElasticsearchConfiguration) (*Elasticsea
return &ElasticsearchConfig{}, nil
}

config.Plugins = []string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
config.Plugins = []string{}

Copy link
Contributor

@dimuon dimuon left a comment

Choose a reason for hiding this comment

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

It looks like acceptance tests failed due to the mentioned change to ES config's plugins initialization.

Besides that issue, LGTM 👍 . Thank you for the PR!

@tobio
Copy link
Member Author

tobio commented Jul 14, 2023

@jamesagarside correct, I've been explicitly testing that issue locally with this change as well.

@jamesagarside
Copy link

🥳🥳🥳

@tobio
Copy link
Member Author

tobio commented Jul 17, 2023

Will need to explicitly set cloud_id to computed on name changes or when kibana is added/removed.

@jamesagarside
Copy link

Terraform Provider

@tobio tobio requested a review from alaudazzi as a code owner July 31, 2023 09:58
@tobio tobio merged commit 21dd383 into elastic:master Aug 5, 2023
@tobio tobio deleted the tf-1.4+ branch August 5, 2023 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite ec_deployment.elasticsearch.config drift when using ec 0.6.0 and terraform 1.4.0
4 participants