Skip to content

Commit

Permalink
fix issue #75 and prep release (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
martezr authored Jan 17, 2024
1 parent c93e2b3 commit 3ddc181
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## UNRELEASED

## 0.9.8 (January 17, 2024)

NOTES:

* Added support for network groups and domain attribute for the `morpheus_vsphere_instance` resource [75](https://github.com/gomorpheus/terraform-provider-morpheus/issues/75).
* Added support for managing local user accounts with the addition of the `morpheus_user` resource [187](https://github.com/gomorpheus/terraform-provider-morpheus/issues/187).
* Updated resources that include multiline text fields such as catalog items, automation tasks, options lists and more to properly handle heredoc syntax. This change stops resources from continually wanting to apply changes because of a trailing newline character [193](https://github.com/gomorpheus/terraform-provider-morpheus/issues/193).
* Added support for managing tenant user roles with the addition of the `morpheus_tenant_role` resource [190](https://github.com/gomorpheus/terraform-provider-morpheus/issues/190).
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ terraform {
required_providers {
morpheus = {
source = "gomorpheus/morpheus"
version = "0.9.7"
version = "0.9.8"
}
}
}
Expand Down Expand Up @@ -59,9 +59,9 @@ $ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding morpheusdata.com/gomorpheus/morpheus versions matching "0.9.7"...
- Installing morpheusdata.com/gomorpheus/morpheus v0.9.7...
- Installed morpheusdata.com/gomorpheus/morpheus v0.9.7 (unauthenticated)
- Finding morpheusdata.com/gomorpheus/morpheus versions matching "0.9.8"...
- Installing morpheusdata.com/gomorpheus/morpheus v0.9.8...
- Installed morpheusdata.com/gomorpheus/morpheus v0.9.8 (unauthenticated)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ terraform {
required_providers {
morpheus = {
source = "gomorpheus/morpheus"
version = "0.9.7"
version = "0.9.8"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/vsphere_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ resource "morpheus_vsphere_instance" "tf_example_vsphere_instance" {
- `create_user` (Boolean) Whether to create a user account on the instance that is associated with the provisioning user account
- `custom_options` (Map of String) Custom options to pass to the instance
- `description` (String) The user friendly description of the instance
- `domain_id` (Number) The ID of the network domain to provision the instance to
- `environment` (String) The environment to assign the instance to
- `evar` (Block List) The environment variables to create (see [below for nested schema](#nestedblock--evar))
- `interfaces` (Block List) The instance network interfaces to create (see [below for nested schema](#nestedblock--interfaces))
Expand Down Expand Up @@ -129,6 +130,7 @@ Optional:

- `ip_address` (String)
- `ip_mode` (String)
- `network_group` (Boolean) Whether the network id provided is for a network group or not
- `network_id` (Number) The network to assign the network interface to
- `network_interface_type_id` (Number) The network interface type

Expand Down
2 changes: 1 addition & 1 deletion examples/guides/getting_started/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
morpheus = {
source = "gomorpheus/morpheus"
version = "0.9.7"
version = "0.9.8"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
morpheus = {
source = "gomorpheus/morpheus"
version = "0.9.7"
version = "0.9.8"
}
}
}
Expand Down
27 changes: 25 additions & 2 deletions morpheus/resource_vsphere_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ func resourceVsphereInstance() *schema.Resource {
Optional: true,
Computed: true,
},
"domain_id": {
Description: "The ID of the network domain to provision the instance to",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
},
"environment": {
Description: "The environment to assign the instance to",
Type: schema.TypeString,
Expand Down Expand Up @@ -239,6 +246,12 @@ func resourceVsphereInstance() *schema.Resource {
Optional: true,
Computed: true,
},
"network_group": {
Description: "Whether the network id provided is for a network group or not",
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"ip_address": {
Description: "",
Type: schema.TypeString,
Expand Down Expand Up @@ -353,6 +366,9 @@ func resourceVsphereInstanceCreate(ctx context.Context, d *schema.ResourceData,
"code": instanceLayout.Code,
"name": instanceLayout.Name,
},
"networkDomain": map[string]interface{}{
"id": d.Get("domain_id").(int),
},
}

// Description
Expand Down Expand Up @@ -539,6 +555,7 @@ func resourceVsphereInstanceRead(ctx context.Context, d *schema.ResourceData, me
d.Set("nested_virtualization", true)
}
d.Set("custom_options", instance.Config["customOptions"])
d.Set("domain_id", instance.NetworkDomain.Id)
return diags
}

Expand Down Expand Up @@ -630,8 +647,14 @@ func parseNetworkInterfaces(interfaces []interface{}) []map[string]interface{} {
row := make(map[string]interface{})
item := (interfaces)[i].(map[string]interface{})
if item["network_id"] != nil {
row["network"] = map[string]interface{}{
"id": fmt.Sprintf("network-%d", item["network_id"].(int)),
if item["network_group"].(bool) {
row["network"] = map[string]interface{}{
"id": fmt.Sprintf("networkGroup-%d", item["network_id"].(int)),
}
} else {
row["network"] = map[string]interface{}{
"id": fmt.Sprintf("network-%d", item["network_id"].(int)),
}
}
}
if item["ip_address"] != nil {
Expand Down
6 changes: 3 additions & 3 deletions templates/guides/getting_started.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ $ terraform init
Initializing the backend...

Initializing provider plugins...
- Finding morpheusdata.com/gomorpheus/morpheus versions matching "0.9.7"...
- Installing morpheusdata.com/gomorpheus/morpheus v0.9.7...
- Installed morpheusdata.com/gomorpheus/morpheus v0.9.7 (unauthenticated)
- Finding morpheusdata.com/gomorpheus/morpheus versions matching "0.9.8"...
- Installing morpheusdata.com/gomorpheus/morpheus v0.9.8...
- Installed morpheusdata.com/gomorpheus/morpheus v0.9.8 (unauthenticated)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
Expand Down

0 comments on commit 3ddc181

Please sign in to comment.