Skip to content

Conversation

@ezilber-akamai
Copy link
Contributor

@ezilber-akamai ezilber-akamai commented Feb 21, 2025

📝 Description

Added the lkeversion datasource. Also added support for the tier field in the lkeversions datasource.

The lkeversion datasource can be used to call both GET /v4beta/lke/versions/<versionID> and GET /v4beta/lke/versions/<tier>/<versionID> endpoints.

The lkeversions datasource can be used to call both GET /v4beta/lke/versions/<tier> and GET /v4beta/lke/versions endpoints.

✔️ How to Test

The following steps assume you have pulled down this PR locally.

Unit Tests

make test-unit

Integration Tests

make test-int PKG_NAME="lkeversion" TEST_CASE="TestAccDataSourceLinodeLkeVersion"
make test-int PKG_NAME="lkeversions" TEST_CASE="TestAccDataSourceLinodeLkeVersions"

Manual Tests

The following steps assume you have pulled down this PR locally.

  1. Using a terraform-provider-linode sandbox environment (e.g. dx-devenv), apply the following configuration (make sure to use v4beta):
data "linode_lke_versions" "versions_no_tier" {}

output "lke_versions_no_tier" {
  value = data.linode_lke_versions.versions_no_tier
}

data "linode_lke_versions" "versions_tier" {
    tier = "enterprise"
}

output "lke_versions_tier" {
  value = data.linode_lke_versions.versions_tier
}

data "linode_lke_version" "version_no_tier" {
    id = "1.31"
}

output "lke_version_no_tier" {
  value = data.linode_lke_version.version_no_tier
}

data "linode_lke_version" "version_tier" {
    id = "v1.31.1+lke1"
    tier = "enterprise"
}

output "lke_version_tier" {
  value = data.linode_lke_version.version_tier
}
  1. Ensure the output is accurate.

@ezilber-akamai ezilber-akamai force-pushed the TPT-3373-lke-tier-versions branch 3 times, most recently from d4330a6 to 077f131 Compare February 24, 2025 16:29
@ezilber-akamai ezilber-akamai added the do-not-merge PRs that should not be merged until the commented issue is resolved label Feb 24, 2025
@ezilber-akamai ezilber-akamai marked this pull request as ready for review February 24, 2025 16:44
@ezilber-akamai ezilber-akamai requested a review from a team as a code owner February 24, 2025 16:44
@ezilber-akamai ezilber-akamai requested review from ykim-akamai and zliang-akamai and removed request for a team February 24, 2025 16:44
@ezilber-akamai
Copy link
Contributor Author

I was not able to find a way to entirely omit the tier fields from the state when the user does not provide it. Instead, it shows up in the state with a value of null. Any ideas on how to improve this?

@ezilber-akamai ezilber-akamai added the new-feature for new features in the changelog. label Feb 24, 2025
@ezilber-akamai ezilber-akamai force-pushed the TPT-3373-lke-tier-versions branch from 077f131 to fb723cf Compare February 24, 2025 19:16
@zliang-akamai
Copy link
Member

Can we use statecheck for newly implemented tests?
https://developer.hashicorp.com/terraform/plugin/testing/acceptance-tests/state-checks/resource

@ezilber-akamai ezilber-akamai added do-not-merge PRs that should not be merged until the commented issue is resolved and removed do-not-merge PRs that should not be merged until the commented issue is resolved labels Mar 3, 2025
@ezilber-akamai ezilber-akamai removed the do-not-merge PRs that should not be merged until the commented issue is resolved label Mar 5, 2025
@yec-akamai yec-akamai self-requested a review March 5, 2025 20:55
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Nice work! Thank you for addressing the two data sources and quickly responded to the API change. Just a few small things:

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Tested and works as expect, nice job!

Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

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

LGTM, verified locally. Nice work!

@ezilber-akamai ezilber-akamai merged commit d7477ac into linode:dev Mar 10, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants