Skip to content
Open
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
152 changes: 152 additions & 0 deletions cloudstack/data_source_cloudstack_autoscale_policy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//

package cloudstack

import (
"fmt"
"log"

"github.com/apache/cloudstack-go/v2/cloudstack"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceCloudstackAutoscalePolicy() *schema.Resource {
return &schema.Resource{
Read: dataSourceCloudstackAutoscalePolicyRead,

Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"action": {
Type: schema.TypeString,
Computed: true,
},

"duration": {
Type: schema.TypeInt,
Computed: true,
},

"quiet_time": {
Type: schema.TypeInt,
Computed: true,
},

"condition_ids": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},

"account_name": {
Type: schema.TypeString,
Computed: true,
},

"domain_id": {
Type: schema.TypeString,
Computed: true,
},

"project_id": {
Type: schema.TypeString,
Computed: true,
},
},
}
}

func dataSourceCloudstackAutoscalePolicyRead(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient)

id, idOk := d.GetOk("id")
name, nameOk := d.GetOk("name")

if !idOk && !nameOk {
return fmt.Errorf("either 'id' or 'name' must be specified")
}

var policy *cloudstack.AutoScalePolicy

if idOk {
p := cs.AutoScale.NewListAutoScalePoliciesParams()
p.SetId(id.(string))

resp, err := cs.AutoScale.ListAutoScalePolicies(p)
if err != nil {
return fmt.Errorf("failed to list autoscale policies: %s", err)
}

if resp.Count == 0 {
return fmt.Errorf("autoscale policy with ID %s not found", id.(string))
}

policy = resp.AutoScalePolicies[0]
} else {
p := cs.AutoScale.NewListAutoScalePoliciesParams()

resp, err := cs.AutoScale.ListAutoScalePolicies(p)
if err != nil {
return fmt.Errorf("failed to list autoscale policies: %s", err)
}

for _, pol := range resp.AutoScalePolicies {
if pol.Name == name.(string) {
policy = pol
break
}
}

if policy == nil {
return fmt.Errorf("autoscale policy with name %s not found", name.(string))
}
}

log.Printf("[DEBUG] Found autoscale policy: %s", policy.Name)

d.SetId(policy.Id)
d.Set("name", policy.Name)
d.Set("action", policy.Action)
d.Set("duration", policy.Duration)
d.Set("quiet_time", policy.Quiettime)
d.Set("account_name", policy.Account)
d.Set("domain_id", policy.Domainid)
if policy.Projectid != "" {
d.Set("project_id", policy.Projectid)
}

conditionIds := make([]string, len(policy.Conditions))
for i, condition := range policy.Conditions {
conditionIds[i] = condition.Id

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / build

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / build

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.2.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.0.1

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.3.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.20.1.0

condition.Id undefined (type string has no field or method Id)

Check failure on line 147 in cloudstack/data_source_cloudstack_autoscale_policy.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.1.3

condition.Id undefined (type string has no field or method Id)
}
d.Set("condition_ids", conditionIds)

return nil
}
188 changes: 188 additions & 0 deletions cloudstack/data_source_cloudstack_autoscale_vm_group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//

package cloudstack

import (
"fmt"
"log"

"github.com/apache/cloudstack-go/v2/cloudstack"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceCloudstackAutoscaleVMGroup() *schema.Resource {
return &schema.Resource{
Read: dataSourceCloudstackAutoscaleVMGroupRead,

Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"lbrule_id": {
Type: schema.TypeString,
Computed: true,
},

"min_members": {
Type: schema.TypeInt,
Computed: true,
},

"max_members": {
Type: schema.TypeInt,
Computed: true,
},

"vm_profile_id": {
Type: schema.TypeString,
Computed: true,
},

"scaleup_policy_ids": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},

"scaledown_policy_ids": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},

"state": {
Type: schema.TypeString,
Computed: true,
},

"interval": {
Type: schema.TypeInt,
Computed: true,
},

"available_virtual_machine_count": {
Type: schema.TypeInt,
Computed: true,
},

"account_name": {
Type: schema.TypeString,
Computed: true,
},

"domain_id": {
Type: schema.TypeString,
Computed: true,
},

"project_id": {
Type: schema.TypeString,
Computed: true,
},
},
}
}

func dataSourceCloudstackAutoscaleVMGroupRead(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient)

id, idOk := d.GetOk("id")
name, nameOk := d.GetOk("name")

if !idOk && !nameOk {
return fmt.Errorf("either 'id' or 'name' must be specified")
}

var group *cloudstack.AutoScaleVmGroup

if idOk {
p := cs.AutoScale.NewListAutoScaleVmGroupsParams()
p.SetId(id.(string))

resp, err := cs.AutoScale.ListAutoScaleVmGroups(p)
if err != nil {
return fmt.Errorf("failed to list autoscale VM groups: %s", err)
}

if resp.Count == 0 {
return fmt.Errorf("autoscale VM group with ID %s not found", id.(string))
}

group = resp.AutoScaleVmGroups[0]
} else {
p := cs.AutoScale.NewListAutoScaleVmGroupsParams()

resp, err := cs.AutoScale.ListAutoScaleVmGroups(p)
if err != nil {
return fmt.Errorf("failed to list autoscale VM groups: %s", err)
}

for _, grp := range resp.AutoScaleVmGroups {
if grp.Name == name.(string) {
group = grp
break
}
}

if group == nil {
return fmt.Errorf("autoscale VM group with name %s not found", name.(string))
}
}

log.Printf("[DEBUG] Found autoscale VM group: %s", group.Name)

d.SetId(group.Id)
d.Set("name", group.Name)
d.Set("lbrule_id", group.Lbruleid)
d.Set("min_members", group.Minmembers)
d.Set("max_members", group.Maxmembers)
d.Set("vm_profile_id", group.Vmprofileid)
d.Set("state", group.State)
d.Set("interval", group.Interval)
d.Set("available_virtual_machine_count", group.Availablevirtualmachinecount)
d.Set("account_name", group.Account)
d.Set("domain_id", group.Domainid)
if group.Projectid != "" {
d.Set("project_id", group.Projectid)
}

scaleupPolicyIds := make([]string, len(group.Scaleuppolicies))
for i, policy := range group.Scaleuppolicies {
scaleupPolicyIds[i] = policy.Id

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / build

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / build

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 177 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)
}
d.Set("scaleup_policy_ids", scaleupPolicyIds)

scaledownPolicyIds := make([]string, len(group.Scaledownpolicies))
for i, policy := range group.Scaledownpolicies {
scaledownPolicyIds[i] = policy.Id

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / build

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / build

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.2.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.11.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.9.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.19.0.1

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.3.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / OpenTofu 1.8.* with Cloudstack 4.20.1.0

policy.Id undefined (type string has no field or method Id)

Check failure on line 183 in cloudstack/data_source_cloudstack_autoscale_vm_group.go

View workflow job for this annotation

GitHub Actions / Terraform 1.12.* with Cloudstack 4.19.1.3

policy.Id undefined (type string has no field or method Id)
}
d.Set("scaledown_policy_ids", scaledownPolicyIds)

return nil
}
Loading
Loading