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

0.2.1 #54

Merged
merged 4 commits into from
Jul 3, 2020
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
## 0.3.0 (Unreleased)
## 0.2.1 (Unreleased)

BUG FIXES:
* resources/opennebula_virtual_machine: Revert regression introduced by b071b27b4b9f722e881f3954531a192e3cd99275 ([#52](https://github.com/terraform-providers/terraform-provider-opennebula/issues/52))
* resources/opennebula_template: Revert regression introduced by b071b27b4b9f722e881f3954531a192e3cd99275 ([#52](https://github.com/terraform-providers/terraform-provider-opennebula/issues/52))
* resources/opennebula_virtual_machine_group: Remove Computed for tags ([#53](https://github.com/terraform-providers/terraform-provider-opennebula/issues/53))
* resources/opennebula_virtual_machine: Remove Computed for tags ([#53](https://github.com/terraform-providers/terraform-provider-opennebula/issues/53))
* resources/opennebula_virtual_template: Remove Computed for tags ([#53](https://github.com/terraform-providers/terraform-provider-opennebula/issues/53))

## 0.2.0 (July 02, 2020)

NOTES:
Expand Down
6 changes: 2 additions & 4 deletions opennebula/resource_opennebula_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ func TestAccTemplate(t *testing.T) {
CheckDestroy: testAccCheckTemplateDestroy,
Steps: []resource.TestStep{
{
Config: testAccTemplateConfigBasic,
ExpectNonEmptyPlan: true,
Config: testAccTemplateConfigBasic,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("opennebula_template.template", "name", "terra-tpl"),
resource.TestCheckResourceAttr("opennebula_template.template", "permissions", "660"),
Expand Down Expand Up @@ -49,8 +48,7 @@ func TestAccTemplate(t *testing.T) {
),
},
{
Config: testAccTemplateConfigUpdate,
ExpectNonEmptyPlan: true,
Config: testAccTemplateConfigUpdate,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("opennebula_template.template", "name", "terratplupdate"),
resource.TestCheckResourceAttr("opennebula_template.template", "permissions", "642"),
Expand Down
9 changes: 3 additions & 6 deletions opennebula/resource_opennebula_virtual_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ func TestAccVirtualMachine(t *testing.T) {
CheckDestroy: testAccCheckVirtualMachineDestroy,
Steps: []resource.TestStep{
{
Config: testAccVirtualMachineTemplateConfigBasic,
ExpectNonEmptyPlan: true,
Config: testAccVirtualMachineTemplateConfigBasic,
Check: resource.ComposeTestCheckFunc(
testAccSetDSdummy(),
resource.TestCheckResourceAttr("opennebula_virtual_machine.test", "name", "test-virtual_machine"),
Expand Down Expand Up @@ -54,8 +53,7 @@ func TestAccVirtualMachine(t *testing.T) {
),
},
{
Config: testAccVirtualMachineConfigUpdate,
ExpectNonEmptyPlan: true,
Config: testAccVirtualMachineConfigUpdate,
Check: resource.ComposeTestCheckFunc(
testAccSetDSdummy(),
resource.TestCheckResourceAttr("opennebula_virtual_machine.test", "name", "test-virtual_machine-renamed"),
Expand Down Expand Up @@ -99,8 +97,7 @@ func TestAccVirtualMachinePending(t *testing.T) {
CheckDestroy: testAccCheckVirtualMachineDestroy,
Steps: []resource.TestStep{
{
Config: testAccVirtualMachinePending,
ExpectNonEmptyPlan: true,
Config: testAccVirtualMachinePending,
Check: resource.ComposeTestCheckFunc(
testAccSetDSdummy(),
resource.TestCheckResourceAttr("opennebula_virtual_machine.test", "name", "virtual_machine_pending"),
Expand Down
24 changes: 0 additions & 24 deletions opennebula/shared_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ func tagsSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeMap,
Optional: true,
Computed: true,
Description: "Add custom tags to the resource",
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -378,10 +377,6 @@ func flattenTemplate(d *schema.ResourceData, vmTemplate *vm.Template, tplTags bo
// Nics
nicList := make([]interface{}, 0, 1)

// Context
context := make(map[string]interface{})
vmcontext, _ := vmTemplate.GetVector(vmk.ContextVec)

// Set VM Group to resource
if vmgIdStr != "" {
vmgMap = append(vmgMap, map[string]interface{}{
Expand Down Expand Up @@ -503,24 +498,5 @@ func flattenTemplate(d *schema.ResourceData, vmTemplate *vm.Template, tplTags bo
}
}

if vmcontext != nil {
for _, p := range vmcontext.Pairs {
// Get only contexts elements from VM template
usercontext := d.Get("context").(map[string]interface{})
for k, _ := range usercontext {
if strings.ToUpper(k) == p.Key() {
context[strings.ToUpper(k)] = p.Value
}
}

if len(context) > 0 {
err := d.Set("context", context)
if err != nil {
return err
}
}
}
}

return nil
}