-
Notifications
You must be signed in to change notification settings - Fork 674
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
Add IBMi Software License field to instance data source and resource #5082
Conversation
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.
Can you update the documentation? Since those will only be in ibmi.
@ismirlia could you fix the |
…m into add_ibm_soft_license
…rm-provider-ibm into add_ibm_soft_license
fix conflicts |
ok I think I misunderstood what you were saying earlier. let me fix it |
Optional: false, | ||
Required: false, |
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.
Kind of contradicting.
Here is the doc:
// Required indicates whether the practitioner must enter a value in the
// configuration for this attribute. Required cannot be used with Computed
// Default, DefaultFunc, DiffSuppressFunc, DiffSuppressOnRefresh,
// InputDefault, Optional, or StateFunc. At least one of Required,
// Optional, Optional and Computed, or Computed must be enabled.
Required [bool](https://pkg.go.dev/builtin#bool)
// Optional indicates whether the practitioner can choose to not enter
// a value in the configuration for this attribute. Optional cannot be used
// with Required.
Optional [bool](https://pkg.go.dev/builtin#bool)
// Computed indicates whether the provider may return its own value for
// this attribute or not. Computed cannot be used with Required. If
// Required and Optional are both false, the attribute will be considered
// "read only" for the practitioner, with only the provider able to set
// its value.
Computed [bool](https://pkg.go.dev/builtin#bool)
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.
@yussufsh I believe there is no contradiction, since the attribute is set by the provider as mention above if both false fir Required
and Optional
If Required and Optional are both false, the attribute will be considered "read only" for the practitioner, with only the provider able to set its 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.
Computed cannot be used with Required.
Just Computed = true was enough.
Just common logic:
Required = true (cannot be Optional)
Optional = true (cannot be Required)
if ibmrdsUsers < 0 { | ||
return diag.Errorf("request with IBMi Rational Dev Studio property requires IBMi Rational Dev Studio number of users") | ||
} |
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.
Not a requirement but we should be using ValidateFunc (ValidateDiagFunc)
https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#validatefunc
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.
That's probably a bit more than I want to change for this PR. Probably mark it as an enhancement.
if ibmrdsUsers.(int) < 0 { | ||
return nil, fmt.Errorf("request with IBMi Rational Dev Studio property requires IBMi Rational Dev Studio number of users") | ||
} |
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.
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.
lgtm
@hkantare Please merge this if there are no more comments. |
…BM-Cloud#5082) * Initial ibmi * ibmi initial, and sync with master * sync go.mod and go.sum * sync go.mod and go.sum * Update instance data source with IBMi licenses * Update instance resource with IBMi licenses * Add instance resource IBMi license acceptance test * Add active check for instance update * Fix updating licenses * Update IBMi terraform documentation * Add wait software licenses update function * Update IBMi license test * Update instance data source * Update instance update license markdown * Remove duplicate markdown definitions * Refactor ibmi license code * Refactor ibmi license code * Update IBMi documentation * Fix duplicate constants * Fix formatting * Fix formatting * Fix typo from merge conflict * Refactor variable names * Fix ibmi documentation * Separate ibmi attribute in data source form ibmi argument in resource --------- Co-authored-by: michaelkad <michaelkadiayi@gmail.com> Co-authored-by: michael kad <michaelkad>
This PR adds the software license fields to instance data source and resource. These fields can be updated. I have added a new acceptance test.