Add files
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/extnet"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/image"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/locations"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||
@@ -41,6 +42,7 @@ func NewDataSourcesMap() map[string]*schema.Resource {
|
||||
"decort_vins": vins.DataSourceVins(),
|
||||
"decort_snapshot_list": snapshot.DataSourceSnapshotList(),
|
||||
"decort_vgpu": vgpu.DataSourceVGPU(),
|
||||
"decort_disk": disks.DataSourceDisk(),
|
||||
"decort_disk_list": disks.DataSourceDiskList(),
|
||||
"decort_rg_list": rg.DataSourceRgList(),
|
||||
"decort_account_list": account.DataSourceAccountList(),
|
||||
@@ -67,6 +69,8 @@ func NewDataSourcesMap() map[string]*schema.Resource {
|
||||
"decort_vins_list": vins.DataSourceVinsList(),
|
||||
"decort_locations_list": locations.DataSourceLocationsList(),
|
||||
"decort_location_url": locations.DataSourceLocationUrl(),
|
||||
"decort_image_list": image.DataSourceImageList(),
|
||||
"decort_image": image.DataSourceImage(),
|
||||
// "decort_pfw": dataSourcePfw(),
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/account"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/image"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/k8s"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/pfw"
|
||||
@@ -45,5 +46,7 @@ func NewRersourcesMap() map[string]*schema.Resource {
|
||||
"decort_account": account.ResourceAccount(),
|
||||
"decort_bservice": bservice.ResourceBasicService(),
|
||||
"decort_bservice_group": bservice.ResourceBasicServiceGroup(),
|
||||
"decort_image": image.ResourceImage(),
|
||||
"decort_image_virtual": image.ResourceImageVirtual(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ package cloudbroker
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/account"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/grid"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||
@@ -30,20 +31,30 @@ import (
|
||||
|
||||
func NewDataSourcesMap() map[string]*schema.Resource {
|
||||
return map[string]*schema.Resource{
|
||||
"decort_image": image.DataSourceImage(),
|
||||
"decort_disk": disks.DataSourceDisk(),
|
||||
"decort_grid": grid.DataSourceGrid(),
|
||||
"decort_grid_list": grid.DataSourceGridList(),
|
||||
"decort_image_list": image.DataSourceImageList(),
|
||||
"decort_image_list_stacks": image.DataSourceImageListStacks(),
|
||||
"decort_pcidevice": pcidevice.DataSourcePcidevice(),
|
||||
"decort_pcidevice_list": pcidevice.DataSourcePcideviceList(),
|
||||
"decort_sep_list": sep.DataSourceSepList(),
|
||||
"decort_sep": sep.DataSourceSep(),
|
||||
"decort_sep_consumption": sep.DataSourceSepConsumption(),
|
||||
"decort_sep_disk_list": sep.DataSourceSepDiskList(),
|
||||
"decort_sep_config": sep.DataSourceSepConfig(),
|
||||
"decort_sep_pool": sep.DataSourceSepPool(),
|
||||
"decort_account": account.DataSourceAccount(),
|
||||
"decort_account_list": account.DataSourceAccountList(),
|
||||
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
||||
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
||||
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
||||
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
||||
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
||||
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
||||
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
||||
"decort_disk": disks.DataSourceDisk(),
|
||||
"decort_disk_list": disks.DataSourceDiskList(),
|
||||
"decort_image": image.DataSourceImage(),
|
||||
"decort_grid": grid.DataSourceGrid(),
|
||||
"decort_grid_list": grid.DataSourceGridList(),
|
||||
"decort_image_list": image.DataSourceImageList(),
|
||||
"decort_image_list_stacks": image.DataSourceImageListStacks(),
|
||||
"decort_pcidevice": pcidevice.DataSourcePcidevice(),
|
||||
"decort_pcidevice_list": pcidevice.DataSourcePcideviceList(),
|
||||
"decort_sep_list": sep.DataSourceSepList(),
|
||||
"decort_sep": sep.DataSourceSep(),
|
||||
"decort_sep_consumption": sep.DataSourceSepConsumption(),
|
||||
"decort_sep_disk_list": sep.DataSourceSepDiskList(),
|
||||
"decort_sep_config": sep.DataSourceSepConfig(),
|
||||
"decort_sep_pool": sep.DataSourceSepPool(),
|
||||
// "decort_pfw": dataSourcePfw(),
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,23 @@ package cloudbroker
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/account"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/k8s"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/kvmvm"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pfw"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/rg"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/snapshot"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/vins"
|
||||
)
|
||||
|
||||
func NewRersourcesMap() map[string]*schema.Resource {
|
||||
return map[string]*schema.Resource{
|
||||
"decort_account": account.ResourceAccount(),
|
||||
"decort_disk": disks.ResourceDisk(),
|
||||
"decort_image": image.ResourceImage(),
|
||||
"decort_virtual_image": image.ResourceVirtualImage(),
|
||||
"decort_cdrom_image": image.ResourceCDROMImage(),
|
||||
@@ -35,5 +45,12 @@ func NewRersourcesMap() map[string]*schema.Resource {
|
||||
"decort_pcidevice": pcidevice.ResourcePcidevice(),
|
||||
"decort_sep": sep.ResourceSep(),
|
||||
"decort_sep_config": sep.ResourceSepConfig(),
|
||||
"decort_resgroup": rg.ResourceResgroup(),
|
||||
"decort_kvmvm": kvmvm.ResourceCompute(),
|
||||
"decort_vins": vins.ResourceVins(),
|
||||
"decort_pfw": pfw.ResourcePfw(),
|
||||
"decort_k8s": k8s.ResourceK8s(),
|
||||
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
||||
"decort_snapshot": snapshot.ResourceSnapshot(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ package provider
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||
"golang.org/x/net/context"
|
||||
@@ -105,24 +106,22 @@ func Provider() *schema.Provider {
|
||||
|
||||
DataSourcesMap: selectSchema(true),
|
||||
|
||||
ConfigureFunc: providerConfigure,
|
||||
ConfigureContextFunc: providerConfigure,
|
||||
}
|
||||
}
|
||||
|
||||
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||
func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {
|
||||
decsController, err := controller.ControllerConfigure(d)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, diag.FromErr(err)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
gridId, err := location.UtilityLocationGetDefaultGridID(ctx, decsController)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, diag.FromErr(err)
|
||||
}
|
||||
if gridId == 0 {
|
||||
return nil, fmt.Errorf("providerConfigure: invalid default Grid ID = 0")
|
||||
return nil, diag.FromErr(fmt.Errorf("providerConfigure: invalid default Grid ID = 0"))
|
||||
}
|
||||
|
||||
return decsController, nil
|
||||
|
||||
Reference in New Issue
Block a user