Skip to content

Commit

Permalink
Feat/1.9.1 (#609)
Browse files Browse the repository at this point in the history
Co-authored-by: Abhishekism9450 <[email protected]>
Co-authored-by: Abhishek <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2023
1 parent 41c7eda commit 2324d3d
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 23 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.9.1 (June 14, 2023)
[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/feat/1.9.0...feat/1.9.1)

**Implemented enhancements:**
- Handling version in ReadContext for "nutanix_karbon_cluster" resource. [\#606](https://github.com/nutanix/terraform-provider-nutanix/pull/606)
- Changed Port field in "resource_karbon_private_registry" to Optional. [\#607](https://github.com/nutanix/terraform-provider-nutanix/pull/607)
- NDB clusters endpoint to have support for Active Directory. [\#608](https://github.com/nutanix/terraform-provider-nutanix/pull/608)

**Closed issues:**
- Add support documentation in terraform. [\#611](https://github.com/nutanix/terraform-provider-nutanix/issues/611)


## 1.9.0 (May 26, 2023)
[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/feat/1.8.1...feat/1.9.0)

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Terraform provider plugin to integrate with Nutanix Enterprise Cloud

NOTE: The latest version of the Nutanix provider is [v1.9.0](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.9.0)
NOTE: The latest version of the Nutanix provider is [v1.9.1](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.9.1)

Modules based on Terraform Nutanix Provider can be found here : [Modules](https://github.com/nutanix/terraform-provider-nutanix/tree/master/modules)
## Build, Quality Status
Expand All @@ -15,6 +15,10 @@ Modules based on Terraform Nutanix Provider can be found here : [Modules](https:
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [![Build Status](https://travis-ci.org/nutanix/terraform-provider-nutanix.svg?branch=master)](https://travis-ci.org/nutanix/terraform-provider-nutanix) | [![Build Status](https://travis-ci.org/nutanix/terraform-provider-nutanix.svg?branch=develop)](https://travis-ci.org/nutanix/terraform-provider-nutanix) |

## Support

Terraform Nutanix Provider leverages the community-supported model. See [Open Source Support](https://portal.nutanix.com/page/documents/kbs/details?targetId=kA07V000000LdWPSA0) for more information about its support policy.

## Community

Nutanix is taking an inclusive approach to developing this new feature and welcomes customer feedback. Please see our development project on GitHub (you're here!), comment on requirements, design, code, and/or feel free to join us on Slack. Instructions on commenting, contributing, and joining our community Slack channel are all located within our GitHub Readme.
Expand Down
6 changes: 3 additions & 3 deletions client/era/era_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ func (sc ServiceClient) GetProfile(ctx context.Context, filter *ProfileFilter) (
func (sc ServiceClient) GetCluster(ctx context.Context, id string, name string) (*ListClusterResponse, error) {
var path string
if id != "" {
path = fmt.Sprintf("/clusters/%s?count_entities=true", id)
path = fmt.Sprintf("/clusters/%s", id)
}
if name != "" {
path = fmt.Sprintf("/clusters/name/%s?count_entities=true", name)
path = fmt.Sprintf("/clusters/name/%s", name)
}
httpReq, err := sc.c.NewRequest(ctx, http.MethodGet, path, nil)
if err != nil {
Expand All @@ -147,7 +147,7 @@ func (sc ServiceClient) GetCluster(ctx context.Context, id string, name string)
}

func (sc ServiceClient) ListClusters(ctx context.Context) (*ClusterListResponse, error) {
httpReq, err := sc.c.NewRequest(ctx, http.MethodGet, "/clusters?count_entities=true", nil)
httpReq, err := sc.c.NewRequest(ctx, http.MethodGet, "/clusters", nil)
if err != nil {
return nil, err
}
Expand Down
22 changes: 11 additions & 11 deletions client/karbon/karbon_private_registry_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ package karbon
type PrivateRegistryListResponse []PrivateRegistryResponse

type PrivateRegistryResponse struct {
Name *string `json:"name" mapstructure:"name, omitempty"`
Endpoint *string `json:"endpoint" mapstructure:"endpoint, omitempty"`
UUID *string `json:"uuid" mapstructure:"uuid, omitempty"`
Name *string `json:"name" mapstructure:"name,omitempty"`
Endpoint *string `json:"endpoint" mapstructure:"endpoint,omitempty"`
UUID *string `json:"uuid" mapstructure:"uuid,omitempty"`
}

type PrivateRegistryIntentInput struct {
Name *string `json:"name" mapstructure:"name, omitempty"`
Cert *string `json:"cert" mapstructure:"cert, omitempty"`
URL *string `json:"url" mapstructure:"url, omitempty"`
Port *int64 `json:"port" mapstructure:"port, omitempty"`
Username *string `json:"username" mapstructure:"username, omitempty"`
Password *string `json:"password" mapstructure:"password, omitempty"`
Name *string `json:"name" mapstructure:"name,omitempty"`
Cert *string `json:"cert" mapstructure:"cert,omitempty"`
URL *string `json:"url" mapstructure:"url,omitempty"`
Port *int64 `json:"port,omitempty" mapstructure:"port,omitempty"`
Username *string `json:"username,omitempty" mapstructure:"username,omitempty"`
Password *string `json:"password,omitempty" mapstructure:"password,omitempty"`
}

type PrivateRegistryOperationResponse struct {
RegistryName *string `json:"registry_name" mapstructure:"registry_name, omitempty"`
RegistryName *string `json:"registry_name" mapstructure:"registry_name,omitempty"`
}

type PrivateRegistryOperationIntentInput struct {
RegistryName *string `json:"registry_name" mapstructure:"registry_name, omitempty"`
RegistryName *string `json:"registry_name" mapstructure:"registry_name,omitempty"`
}
30 changes: 24 additions & 6 deletions nutanix/resource_nutanix_karbon_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,16 @@ func resourceNutanixKarbonClusterRead(ctx context.Context, d *schema.ResourceDat
}

// Must use know version because GA API reports different version
var versionSet string
if version, ok := d.GetOk("version"); ok {
versionSet = version.(string)
} else {
versionSet = utils.StringValue(resp.Version)
karbonVersion, er := conn.Meta.GetSemanticVersion()
if er != nil {
return diag.Errorf("error getting karbon version")
}
if err = d.Set("version", versionSet); err != nil {

karbonVersionSet := checkKarbonVersion(d, karbonVersion, resp)
if err = d.Set("version", karbonVersionSet); err != nil {
return diag.Errorf("error setting version for Karbon Cluster %s: %s", d.Id(), err)
}

if err = d.Set("kubeapi_server_ipv4_address", utils.StringValue(resp.KubeAPIServerIPv4Address)); err != nil {
return diag.Errorf("error setting kubeapi_server_ipv4_address for Karbon Cluster %s: %s", d.Id(), err)
}
Expand Down Expand Up @@ -1254,3 +1255,20 @@ func calculateCPURequirement(karbonVersion *karbon.MetaSemanticVersionResponse,
log.Printf("[DEBUG] version was 2.2.2 or higher. NOT applying CPU workaround")
return amountOfCPU, nil
}

func checkKarbonVersion(d *schema.ResourceData, karbonVersion *karbon.MetaSemanticVersionResponse, karbonResp *karbon.ClusterIntentResponse) string {
const baseMajorVersion int64 = 2
const baseMinorVersion int64 = 2
const baseRevVersion int64 = 3
var versionSet string
if karbonVersion.MajorVersion <= baseMajorVersion && karbonVersion.MinorVersion <= baseMinorVersion && karbonVersion.RevisionVersion < baseRevVersion {
if version, ok := d.GetOk("version"); ok {
versionSet = version.(string)
} else {
versionSet = utils.StringValue(karbonResp.Version)
}
} else {
versionSet = *karbonResp.Version
}
return versionSet
}
4 changes: 2 additions & 2 deletions nutanix/resource_nutanix_karbon_private_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func KarbonPrivateRegistryResourceMap() map[string]*schema.Schema {
},
"port": {
Type: schema.TypeInt,
Required: true,
Optional: true,
ValidateFunc: validation.IntAtLeast(1),
},
"endpoint": {
Expand Down Expand Up @@ -87,7 +87,7 @@ func resourceNutanixKarbonPrivateRegistryCreate(ctx context.Context, d *schema.R
} else {
return diag.Errorf("error occurred during private registry creation: url must be set")
}
if port, ok := d.GetOk("port"); ok {
if port, ok := d.GetOk("port"); ok && port.(int) > 0 {
p := int64(port.(int))
karbonPrivateRegistry.Port = &p
}
Expand Down
5 changes: 5 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The provider is used to interact with the many resources and data sources suppor

Use the navigation on the left to read about the available resources and data sources this provider can use.

## Support

Terraform Nutanix Provider leverages the community-supported model. See [Open Source Support](https://portal.nutanix.com/page/documents/kbs/details?targetId=kA07V000000LdWPSA0) for more information about its support policy.

## Example Usage

### Terraform 0.12 and below
Expand Down Expand Up @@ -154,3 +158,4 @@ Going from 1.8.0-beta release of nutanix provider, fields inside provider config
* `Prism Central & Karbon` : For prism central and karbon related resources and data sources, `username`, `password` & `endpoint` are manadatory.
* `Foundation` : For foundation related resources and data sources, `foundation_endpoint` in manadatory.
* `NDB` : For Nutanix Database Service (NDB) related resources and data sources.

0 comments on commit 2324d3d

Please sign in to comment.