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

Ignore create_service_account with NSX 9.0.0 #1471

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions nsxt/resource_nsxt_compute_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/vmware/terraform-provider-nsxt/nsxt/util"
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
"github.com/vmware/vsphere-automation-sdk-go/runtime/data"
"github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/fabric"
Expand Down Expand Up @@ -248,7 +249,6 @@ func resourceNsxtComputeManagerCreate(d *schema.ResourceData, m interface{}) err
DisplayName: &displayName,
Tags: tags,
AccessLevelForOidc: accessLevelForOidc,
CreateServiceAccount: &createServiceAccount,
Credential: credential,
ExtensionCertificate: getExtensionCertificate(d),
MultiNsx: &multiNSX,
Expand All @@ -258,6 +258,12 @@ func resourceNsxtComputeManagerCreate(d *schema.ResourceData, m interface{}) err
SetAsOidcProvider: &setAsOidcProvider,
}

// From 9.0.0 onwards CreateServiceAccount can not be false
// so we can effetively ignore this field
if util.NsxVersionLower("9.0.0") {
obj.CreateServiceAccount = &createServiceAccount
}

log.Printf("[INFO] Creating Compute Manager %s", displayName)
obj, err = client.Create(obj)
if err != nil {
Expand Down Expand Up @@ -505,7 +511,6 @@ func resourceNsxtComputeManagerUpdate(d *schema.ResourceData, m interface{}) err
DisplayName: &displayName,
Tags: tags,
AccessLevelForOidc: accessLevelForOidc,
CreateServiceAccount: &createServiceAccount,
Credential: credential,
ExtensionCertificate: getExtensionCertificate(d),
MultiNsx: &multiNSX,
Expand All @@ -516,6 +521,12 @@ func resourceNsxtComputeManagerUpdate(d *schema.ResourceData, m interface{}) err
Revision: &revision,
}

// From 9.0.0 onwards CreateServiceAccount can not be false
// so we can effetively ignore this field
if util.NsxVersionLower("9.0.0") {
obj.CreateServiceAccount = &createServiceAccount
}

_, err = client.Update(id, obj)
if err != nil {
return handleUpdateError("ComputeManager", id, err)
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_manager.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The following arguments are supported:
* `description` - (Optional) Description of the resource.
* `tag` - (Optional) A list of scope + tag pairs to associate with this resource.
* `access_level_for_oidc` - (Optional) Specifies access level to NSX from the compute manager. Accepted values - 'FULL' or 'LIMITED'. The default value is 'FULL'.
* `create_service_account` - (Optional) Specifies whether service account is created or not on compute manager. Note that the default for this setting has changed with NSX 9.0 from `false` to `true`.
* `create_service_account` - (Optional) Specifies whether service account is created or not on compute manager. Note that `false` value for this attribute is no longer supported with NSX 9.0 and above.
* `credential` - (Required) Login credentials for the compute manager. Should contain exactly one credential enlisted below:
* `saml_login` - (Optional) A login credential specifying saml token.
* `thumbprint` - (Required) Thumbprint of the server.
Expand Down