-
Notifications
You must be signed in to change notification settings - Fork 400
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
Jobs Methods GoSDK Migration #3577
Conversation
e0ac053
to
228d7ff
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3577 +/- ##
==========================================
- Coverage 82.32% 81.60% -0.73%
==========================================
Files 190 192 +2
Lines 19324 19550 +226
==========================================
+ Hits 15909 15954 +45
- Misses 2483 2645 +162
- Partials 932 951 +19
|
16dd0f0
to
c1cb3af
Compare
4f71e36
to
ef97830
Compare
Verified that nightly integration tests passed for this PR |
} | ||
|
||
// Removing unnecesary fields out of ClusterSpec's ForceSendFields because the current terraform plugin sdk | ||
// has a limitation that it will always set unspecified values to the zero value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some context on how the plugin framework could help in case of null vs zero:
SDKv2 also does not expose Terraform's null or unknown value concepts unambiguously, typically returning both null and unknown values as the same zero-value for the underlying Go type.
The framework type system fully exposes null, unknown, and known value states. You can reliably query each value with the IsNull() or IsUnknown() methods.
https://developer.hashicorp.com/terraform/plugin/framework/migrating/benefits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had some comments, LGTM
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 60, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only adding it as a resource specific field for cluster because job resource never needs it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have left a few questions regarding to changes in our unit tests, and also potential breaking changes for git provider, and some other optional -> required fields
a848387
to
92578dd
Compare
@@ -617,7 +617,7 @@ func iterFields(rv reflect.Value, path []string, s map[string]*schema.Schema, al | |||
return fmt.Errorf("inconsistency: %s has omitempty, but is not optional", fieldName) | |||
} | |||
defaultEmpty := reflect.ValueOf(fieldSchema.Default).Kind() == reflect.Invalid | |||
if fieldSchema.Optional && defaultEmpty && !omitEmpty { | |||
if !isGoSDK && fieldSchema.Optional && defaultEmpty && !omitEmpty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding additional check because we are customizing git_provider
to be optional while it doesn't have omitEmpty
on the go-sdk struct.
1e8493c
to
3bda6d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, thanks for this
### New Features and Improvements * Docs: remove usage of deprecated `azurerm` options from PL guides ([#3606](#3606)). * Jobs Methods GoSDK Migration ([#3577](#3577)). * Do not suppress diff if it is explicitly changed to zero ([#3611](#3611)). * update markdown ([#3621](#3621)). * Fix resource_cluster bug with ebs volume fields ([#3613](#3613)). ### Documentation Changes ### Exporter ### Internal Changes
* Release v1.46.0 ### New Features and Improvements * Docs: remove usage of deprecated `azurerm` options from PL guides ([#3606](#3606)). * Jobs Methods GoSDK Migration ([#3577](#3577)). * Do not suppress diff if it is explicitly changed to zero ([#3611](#3611)). * update markdown ([#3621](#3621)). * Fix resource_cluster bug with ebs volume fields ([#3613](#3613)). ### Documentation Changes ### Exporter ### Internal Changes * - * -
Changes
Read, Update, Create
methods to the go-sdk migration for the jobs resourcecompute.ClusterSpec
as a valid input inresource_cluster.go
jobs_api_go_sdk.go
to replicate go-sdk versions of necessary methods that were part ofJobsApi
omitempty
Read, Update, Create
methods to have two branches, if it's api2.0, make it run the exact same code as before, otherwise, use the go-sdk to perform the same actionstask_key
autotermination_minutes
from the cluster spec used by jobs because it is confirmed to be never useful for jobsTests
make test
run locallydocs/
folderinternal/acceptance