diff --git a/ibm/service/power/data_source_ibm_pi_cloud_connection.go b/ibm/service/power/data_source_ibm_pi_cloud_connection.go index 8e5bc59f83..f877aac73b 100644 --- a/ibm/service/power/data_source_ibm_pi_cloud_connection.go +++ b/ibm/service/power/data_source_ibm_pi_cloud_connection.go @@ -7,116 +7,104 @@ import ( "context" "log" - "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" - "github.com/IBM-Cloud/power-go-client/clients/instance" - "github.com/IBM-Cloud/power-go-client/helpers" "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" -) - -const ( - PICloudConnectionId = "cloud_connection_id" - PICloudConnectionName = "name" - PICloudConnectionSpeed = "speed" - PICloudConnectionGlobalRouting = "global_routing" - PICloudConnectionMetered = "metered" - PICloudConnectionStatus = "status" - PICloudConnectionClassicEnabled = "classic_enabled" - PICloudConnectionUserIPAddress = "user_ip_address" - PICloudConnectionIBMIPAddress = "ibm_ip_address" - PICloudConnectionPort = "port" - PICloudConnectionNetworks = "networks" - PICloudConnectionClassicGreDest = "gre_destination_address" - PICloudConnectionClassicGreSource = "gre_source_address" - PICloudConnectionVPCEnabled = "vpc_enabled" - PICloudConnectionVPCCRNs = "vpc_crns" - PICloudConnectionConnectionMode = "connection_mode" + "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" ) func DataSourceIBMPICloudConnection() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceIBMPICloudConnectionRead, Schema: map[string]*schema.Schema{ - helpers.PICloudInstanceId: { - Type: schema.TypeString, + // Arguments + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", Required: true, + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - helpers.PICloudConnectionName: { - Type: schema.TypeString, + Arg_CloudConnectionName: { + Description: "The cloud connection name to be used.", Required: true, - Description: "Cloud Connection Name to be used", + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - // Computed Attributes - PICloudConnectionSpeed: { - Type: schema.TypeInt, - Computed: true, + // Attributes + Attr_ClassicEnabled: { + Computed: true, + Description: "Enable classic endpoint destination.", + Type: schema.TypeBool, }, - PICloudConnectionGlobalRouting: { - Type: schema.TypeBool, - Computed: true, + Attr_ConnectionMode: { + Computed: true, + Description: "Type of service the gateway is attached to.", + Type: schema.TypeString, }, - PICloudConnectionMetered: { - Type: schema.TypeBool, - Computed: true, + Attr_GlobalRouting: { + Computed: true, + Description: "Enable global routing for this cloud connection.", + Type: schema.TypeBool, }, - PICloudConnectionStatus: { - Type: schema.TypeString, - Computed: true, + Attr_GreDestinationAddress: { + Computed: true, + Description: "GRE destination IP address.", + Type: schema.TypeString, }, - PICloudConnectionIBMIPAddress: { - Type: schema.TypeString, - Computed: true, + Attr_GreSourceAddress: { + Computed: true, + Description: "GRE auto-assigned source IP address.", + Type: schema.TypeString, }, - PICloudConnectionUserIPAddress: { - Type: schema.TypeString, - Computed: true, + Attr_IBMIPAddress: { + Computed: true, + Description: "The IBM IP address.", + Type: schema.TypeString, }, - PICloudConnectionPort: { - Type: schema.TypeString, - Computed: true, + Attr_Metered: { + Computed: true, + Description: "Enable metering for this cloud connection.", + Type: schema.TypeBool, }, - PICloudConnectionNetworks: { - Type: schema.TypeSet, + Attr_Networks: { Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, Description: "Set of Networks attached to this cloud connection", + Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, }, - PICloudConnectionClassicEnabled: { - Type: schema.TypeBool, + Attr_Port: { Computed: true, - Description: "Enable classic endpoint destination", - }, - PICloudConnectionClassicGreDest: { + Description: "Port.", Type: schema.TypeString, + }, + Attr_Speed: { Computed: true, - Description: "GRE destination IP address", + Description: "Speed of the cloud connection (speed in megabits per second)", + Type: schema.TypeInt, }, - PICloudConnectionClassicGreSource: { - Type: schema.TypeString, + Attr_Status: { Computed: true, - Description: "GRE auto-assigned source IP address", + Description: "Link status.", + Type: schema.TypeString, }, - PICloudConnectionVPCEnabled: { - Type: schema.TypeBool, + Attr_UserIPAddress: { Computed: true, - Description: "Enable VPC for this cloud connection", + Description: "User IP address.", + Type: schema.TypeString, }, - PICloudConnectionVPCCRNs: { - Type: schema.TypeSet, + Attr_VPCCRNs: { Computed: true, + Description: "Set of VPCs attached to this cloud connection.", Elem: &schema.Schema{Type: schema.TypeString}, - Description: "Set of VPCs attached to this cloud connection", + Type: schema.TypeSet, }, - PICloudConnectionConnectionMode: { - Type: schema.TypeString, + Attr_VPCEnabled: { Computed: true, - Description: "Type of service the gateway is attached to", + Description: "Enable VPC for this cloud connection.", + Type: schema.TypeBool, }, }, } @@ -128,8 +116,8 @@ func dataSourceIBMPICloudConnectionRead(ctx context.Context, d *schema.ResourceD return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - cloudConnectionName := d.Get(helpers.PICloudConnectionName).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) + cloudConnectionName := d.Get(Arg_CloudConnectionName).(string) client := instance.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) // Get API does not work with name for Cloud Connection hence using GetAll (max 2) @@ -165,16 +153,18 @@ func dataSourceIBMPICloudConnectionRead(ctx context.Context, d *schema.ResourceD } d.SetId(*cloudConnection.CloudConnectionID) - d.Set(helpers.PICloudConnectionName, cloudConnection.Name) - d.Set(PICloudConnectionGlobalRouting, cloudConnection.GlobalRouting) - d.Set(PICloudConnectionMetered, cloudConnection.Metered) - d.Set(PICloudConnectionIBMIPAddress, cloudConnection.IbmIPAddress) - d.Set(PICloudConnectionUserIPAddress, cloudConnection.UserIPAddress) - d.Set(PICloudConnectionStatus, cloudConnection.LinkStatus) - d.Set(PICloudConnectionPort, cloudConnection.Port) - d.Set(PICloudConnectionSpeed, cloudConnection.Speed) - d.Set(helpers.PICloudInstanceId, cloudInstanceID) - d.Set(PICloudConnectionConnectionMode, cloudConnection.ConnectionMode) + + d.Set(Arg_CloudInstanceID, cloudInstanceID) + d.Set(Arg_CloudConnectionName, cloudConnection.Name) + + d.Set(Attr_GlobalRouting, cloudConnection.GlobalRouting) + d.Set(Attr_Metered, cloudConnection.Metered) + d.Set(Attr_IBMIPAddress, cloudConnection.IbmIPAddress) + d.Set(Attr_UserIPAddress, cloudConnection.UserIPAddress) + d.Set(Attr_Status, cloudConnection.LinkStatus) + d.Set(Attr_Port, cloudConnection.Port) + d.Set(Attr_Speed, cloudConnection.Speed) + d.Set(Attr_ConnectionMode, cloudConnection.ConnectionMode) if cloudConnection.Networks != nil { networks := make([]string, len(cloudConnection.Networks)) for i, ccNetwork := range cloudConnection.Networks { @@ -182,24 +172,25 @@ func dataSourceIBMPICloudConnectionRead(ctx context.Context, d *schema.ResourceD networks[i] = *ccNetwork.NetworkID } } - d.Set(PICloudConnectionNetworks, networks) + d.Set(Attr_Networks, networks) } if cloudConnection.Classic != nil { - d.Set(PICloudConnectionClassicEnabled, cloudConnection.Classic.Enabled) + d.Set(Attr_ClassicEnabled, cloudConnection.Classic.Enabled) if cloudConnection.Classic.Gre != nil { - d.Set(PICloudConnectionClassicGreDest, cloudConnection.Classic.Gre.DestIPAddress) - d.Set(PICloudConnectionClassicGreSource, cloudConnection.Classic.Gre.SourceIPAddress) + d.Set(Attr_GreDestinationAddress, cloudConnection.Classic.Gre.DestIPAddress) + d.Set(Attr_GreSourceAddress, cloudConnection.Classic.Gre.SourceIPAddress) } } if cloudConnection.Vpc != nil { - d.Set(PICloudConnectionVPCEnabled, cloudConnection.Vpc.Enabled) + d.Set(Attr_VPCEnabled, cloudConnection.Vpc.Enabled) if cloudConnection.Vpc.Vpcs != nil && len(cloudConnection.Vpc.Vpcs) > 0 { vpcCRNs := make([]string, len(cloudConnection.Vpc.Vpcs)) for i, vpc := range cloudConnection.Vpc.Vpcs { vpcCRNs[i] = *vpc.VpcID } - d.Set(PICloudConnectionVPCCRNs, vpcCRNs) + d.Set(Attr_VPCCRNs, vpcCRNs) } } + return nil } diff --git a/ibm/service/power/data_source_ibm_pi_cloud_connection_test.go b/ibm/service/power/data_source_ibm_pi_cloud_connection_test.go index 732b10ad1f..60eda0cb08 100644 --- a/ibm/service/power/data_source_ibm_pi_cloud_connection_test.go +++ b/ibm/service/power/data_source_ibm_pi_cloud_connection_test.go @@ -30,9 +30,8 @@ func TestAccIBMPICloudConnectionDataSource_basic(t *testing.T) { func testAccCheckIBMPICloudConnectionDataSourceConfig() string { return fmt.Sprintf(` - data "ibm_pi_cloud_connection" "example" { - pi_cloud_connection_name = "%s" - pi_cloud_instance_id = "%s" - } - `, acc.PiCloudConnectionName, acc.Pi_cloud_instance_id) + data "ibm_pi_cloud_connection" "example" { + pi_cloud_connection_name = "%s" + pi_cloud_instance_id = "%s" + }`, acc.PiCloudConnectionName, acc.Pi_cloud_instance_id) } diff --git a/ibm/service/power/data_source_ibm_pi_cloud_connections.go b/ibm/service/power/data_source_ibm_pi_cloud_connections.go index ad5a35e434..2e99b1ea97 100644 --- a/ibm/service/power/data_source_ibm_pi_cloud_connections.go +++ b/ibm/service/power/data_source_ibm_pi_cloud_connections.go @@ -7,113 +7,118 @@ import ( "context" "log" - st "github.com/IBM-Cloud/power-go-client/clients/instance" - "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/hashicorp/go-uuid" "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" ) -/* -Datasource to get the list of Cloud Connections in a power instance -*/ - -const PICloudConnections = "connections" - +// Datasource to list Cloud Connections in a power instance func DataSourceIBMPICloudConnections() *schema.Resource { - return &schema.Resource{ ReadContext: dataSourceIBMPICloudConnectionsRead, Schema: map[string]*schema.Schema{ - helpers.PICloudInstanceId: { - Type: schema.TypeString, + // Arguments + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", Required: true, + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - // Computed Attributes - PICloudConnections: { - Type: schema.TypeList, - Computed: true, + + // Attributes + Attr_Connections: { + Computed: true, + Description: "List of all the Cloud Connections.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - PICloudConnectionId: { - Type: schema.TypeString, - Computed: true, + Attr_ClassicEnabled: { + Computed: true, + Description: "Enable classic endpoint destination.", + Type: schema.TypeBool, }, - PICloudConnectionName: { - Type: schema.TypeString, - Computed: true, + Attr_CloudConnectionID: { + Computed: true, + Description: "The unique identifier of the cloud connection.", + Type: schema.TypeString, }, - PICloudConnectionSpeed: { - Type: schema.TypeInt, - Computed: true, + Attr_ConnectionMode: { + Computed: true, + Description: "Type of service the gateway is attached to.", + Type: schema.TypeString, }, - PICloudConnectionGlobalRouting: { - Type: schema.TypeBool, - Computed: true, + Attr_GlobalRouting: { + Computed: true, + Description: "Enable global routing for this cloud connection.", + Type: schema.TypeBool, }, - PICloudConnectionMetered: { - Type: schema.TypeBool, - Computed: true, + Attr_GreDestinationAddress: { + Computed: true, + Description: "GRE destination IP address.", + Type: schema.TypeString, }, - PICloudConnectionStatus: { - Type: schema.TypeString, - Computed: true, + Attr_GreSourceAddress: { + Computed: true, + Description: "GRE auto-assigned source IP address.", + Type: schema.TypeString, }, - PICloudConnectionIBMIPAddress: { - Type: schema.TypeString, - Computed: true, + Attr_IBMIPAddress: { + Computed: true, + Description: "IBM IP address.", + Type: schema.TypeString, }, - PICloudConnectionUserIPAddress: { - Type: schema.TypeString, - Computed: true, + Attr_Metered: { + Computed: true, + Description: "Enable metering for this cloud connection.", + Type: schema.TypeBool, }, - PICloudConnectionPort: { - Type: schema.TypeString, - Computed: true, + Attr_Name: { + Computed: true, + Description: "Name of the cloud connection.", + Type: schema.TypeString, }, - PICloudConnectionNetworks: { - Type: schema.TypeSet, + Attr_Networks: { Computed: true, + Description: "Set of Networks attached to this cloud connection.", Elem: &schema.Schema{Type: schema.TypeString}, - Description: "Set of Networks attached to this cloud connection", + Type: schema.TypeSet, }, - PICloudConnectionClassicEnabled: { - Type: schema.TypeBool, + Attr_Port: { Computed: true, - Description: "Enable classic endpoint destination", - }, - PICloudConnectionClassicGreDest: { + Description: "Port.", Type: schema.TypeString, + }, + Attr_Speed: { Computed: true, - Description: "GRE destination IP address", + Description: "Speed of the cloud connection (speed in megabits per second).", + Type: schema.TypeInt, }, - PICloudConnectionClassicGreSource: { - Type: schema.TypeString, + Attr_Status: { Computed: true, - Description: "GRE auto-assigned source IP address", + Description: "Link status.", + Type: schema.TypeString, }, - PICloudConnectionVPCEnabled: { - Type: schema.TypeBool, + Attr_UserIPAddress: { Computed: true, - Description: "Enable VPC for this cloud connection", + Description: "User IP address.", + Type: schema.TypeString, }, - PICloudConnectionVPCCRNs: { - Type: schema.TypeSet, + Attr_VPCCRNs: { Computed: true, + Description: "Set of VPCs attached to this cloud connection.", Elem: &schema.Schema{Type: schema.TypeString}, - Description: "Set of VPCs attached to this cloud connection", + Type: schema.TypeSet, }, - PICloudConnectionConnectionMode: { - Type: schema.TypeString, + Attr_VPCEnabled: { Computed: true, - Description: "Type of service the gateway is attached to", + Description: "Enable VPC for this cloud connection.", + Type: schema.TypeBool, }, }, }, + Type: schema.TypeList, }, }, } @@ -125,8 +130,8 @@ func dataSourceIBMPICloudConnectionsRead(ctx context.Context, d *schema.Resource return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - client := st.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) + client := instance.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) cloudConnections, err := client.GetAll() if err != nil { @@ -137,16 +142,16 @@ func dataSourceIBMPICloudConnectionsRead(ctx context.Context, d *schema.Resource result := make([]map[string]interface{}, 0, len(cloudConnections.CloudConnections)) for _, cloudConnection := range cloudConnections.CloudConnections { cc := map[string]interface{}{ - PICloudConnectionId: *cloudConnection.CloudConnectionID, - PICloudConnectionName: *cloudConnection.Name, - PICloudConnectionGlobalRouting: *cloudConnection.GlobalRouting, - PICloudConnectionMetered: *cloudConnection.Metered, - PICloudConnectionIBMIPAddress: *cloudConnection.IbmIPAddress, - PICloudConnectionUserIPAddress: *cloudConnection.UserIPAddress, - PICloudConnectionStatus: *cloudConnection.LinkStatus, - PICloudConnectionPort: *cloudConnection.Port, - PICloudConnectionSpeed: *cloudConnection.Speed, - PICloudConnectionConnectionMode: cloudConnection.ConnectionMode, + Attr_CloudConnectionID: *cloudConnection.CloudConnectionID, + Attr_ConnectionMode: cloudConnection.ConnectionMode, + Attr_GlobalRouting: *cloudConnection.GlobalRouting, + Attr_IBMIPAddress: *cloudConnection.IbmIPAddress, + Attr_Metered: *cloudConnection.Metered, + Attr_Name: *cloudConnection.Name, + Attr_Port: *cloudConnection.Port, + Attr_Speed: *cloudConnection.Speed, + Attr_Status: *cloudConnection.LinkStatus, + Attr_UserIPAddress: *cloudConnection.UserIPAddress, } if cloudConnection.Networks != nil { @@ -156,23 +161,23 @@ func dataSourceIBMPICloudConnectionsRead(ctx context.Context, d *schema.Resource networks[i] = *ccNetwork.NetworkID } } - cc[PICloudConnectionNetworks] = networks + cc[Attr_Networks] = networks } if cloudConnection.Classic != nil { - cc[PICloudConnectionClassicEnabled] = cloudConnection.Classic.Enabled + cc[Attr_ClassicEnabled] = cloudConnection.Classic.Enabled if cloudConnection.Classic.Gre != nil { - cc[PICloudConnectionClassicGreDest] = cloudConnection.Classic.Gre.DestIPAddress - cc[PICloudConnectionClassicGreSource] = cloudConnection.Classic.Gre.SourceIPAddress + cc[Attr_GreDestinationAddress] = cloudConnection.Classic.Gre.DestIPAddress + cc[Attr_GreSourceAddress] = cloudConnection.Classic.Gre.SourceIPAddress } } if cloudConnection.Vpc != nil { - cc[PICloudConnectionVPCEnabled] = cloudConnection.Vpc.Enabled + cc[Attr_VPCEnabled] = cloudConnection.Vpc.Enabled if cloudConnection.Vpc.Vpcs != nil && len(cloudConnection.Vpc.Vpcs) > 0 { vpcCRNs := make([]string, len(cloudConnection.Vpc.Vpcs)) for i, vpc := range cloudConnection.Vpc.Vpcs { vpcCRNs[i] = *vpc.VpcID } - cc[PICloudConnectionVPCCRNs] = vpcCRNs + cc[Attr_VPCCRNs] = vpcCRNs } } @@ -181,7 +186,7 @@ func dataSourceIBMPICloudConnectionsRead(ctx context.Context, d *schema.Resource var genID, _ = uuid.GenerateUUID() d.SetId(genID) - d.Set(PICloudConnections, result) + d.Set(Attr_Connections, result) return nil } diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index 8e66a4bd83..865abc5f02 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -3,18 +3,253 @@ package power import "time" const ( - // used by all - Arg_CloudInstanceID = "pi_cloud_instance_id" + // Arguments + Arg_CloudConnectionName = "pi_cloud_connection_name" + Arg_CloudInstanceID = "pi_cloud_instance_id" + Arg_ImageName = "pi_image_name" + Arg_InstanceName = "pi_instance_name" + Arg_Key = "pi_ssh_key" + Arg_KeyName = "pi_key_name" + Arg_NetworkName = "pi_network_name" + Arg_PlacementGroupName = "pi_placement_group_name" + Arg_SAP = "sap" + Arg_SAPProfileID = "pi_sap_profile_id" + Arg_SPPPlacementGroupID = "pi_spp_placement_group_id" + Arg_SPPPlacementGroupName = "pi_spp_placement_group_name" + Arg_SPPPlacementGroupPolicy = "pi_spp_placement_group_policy" + Arg_SharedProcessorPoolHostGroup = "pi_shared_processor_pool_host_group" + Arg_SharedProcessorPoolID = "pi_shared_processor_pool_id" + Arg_SharedProcessorPoolName = "pi_shared_processor_pool_name" + Arg_SharedProcessorPoolPlacementGroupID = "pi_shared_processor_pool_placement_group_id" + Arg_SharedProcessorPoolReservedCores = "pi_shared_processor_pool_reserved_cores" + Arg_StoragePool = "pi_storage_pool" + Arg_StorageType = "pi_storage_type" + Arg_VTL = "vtl" + Arg_VolumeGroupID = "pi_volume_group_id" + Arg_VolumeID = "pi_volume_id" + Arg_VolumeOnboardingID = "pi_volume_onboarding_id" - // Keys - Arg_KeyName = "pi_key_name" - Arg_Key = "pi_ssh_key" + // Attributes + Attr_AccessConfig = "access_config" + Attr_Action = "action" + Attr_Addresses = "addresses" + Attr_AllocatedCores = "allocated_cores" + Attr_Architecture = "architecture" + Attr_Auxiliary = "auxiliary" + Attr_AuxiliaryChangedVolumeName = "auxiliary_changed_volume_name" + Attr_AuxiliaryVolumeName = "auxiliary_volume_name" + Attr_AvailabilityZone = "availability_zone" + Attr_AvailableCores = "available_cores" + Attr_AvailableIPCount = "available_ip_count" + Attr_BootVolumeID = "boot_volume_id" + Attr_Bootable = "bootable" + Attr_CIDR = "cidr" + Attr_CPUs = "cpus" + Attr_CRN = "crn" + Attr_Capabilities = "capabilities" + Attr_Capacity = "capacity" + Attr_Certified = "certified" + Attr_ClassicEnabled = "classic_enabled" + Attr_CloudConnectionID = "cloud_connection_id" + Attr_CloudInstanceID = "cloud_instance_id" + Attr_CloudInstances = "cloud_instances" + Attr_Code = "code" + Attr_ConnectionMode = "connection_mode" + Attr_Connections = "connections" + Attr_ConsistencyGroupName = "consistency_group_name" + Attr_ConsoleLanguages = "console_languages" + Attr_ContainerFormat = "container_format" + Attr_CopyRate = "copy_rate" + Attr_CopyType = "copy_type" + Attr_CoreMemoryRatio = "core_memory_ratio" + Attr_Cores = "cores" + Attr_CreateTime = "create_time" + Attr_CreationDate = "creation_date" + Attr_CyclePeriodSeconds = "cycle_period_seconds" + Attr_CyclingMode = "cycling_mode" + Attr_DNS = "dns" + Attr_Datacenters = "datacenters" + Attr_Default = "default" + Attr_DeploymentType = "deployment_type" + Attr_Description = "description" + Attr_DisasterRecoveryLocations = "disaster_recovery_locations" + Attr_DiskFormat = "disk_format" + Attr_DiskType = "disk_type" + Attr_Enabled = "enabled" + Attr_Endianness = "endianness" + Attr_ExternalIP = "external_ip" + Attr_FailureMessage = "failure_message" + Attr_FlashCopyMappings = "flash_copy_mappings" + Attr_FlashCopyName = "flash_copy_name" + Attr_FreezeTime = "freeze_time" + Attr_Gateway = "gateway" + Attr_GlobalRouting = "global_routing" + Attr_GreDestinationAddress = "gre_destination_address" + Attr_GreSourceAddress = "gre_source_address" + Attr_GroupID = "group_id" + Attr_HealthStatus = "health_status" + Attr_HostID = "host_id" + Attr_Href = "href" + Attr_Hypervisor = "hypervisor" + Attr_HypervisorType = "hypervisor_type" + Attr_IBMIPAddress = "ibm_ip_address" + Attr_ID = "id" + Attr_IP = "ip" + Attr_IPAddress = "ipaddress" + Attr_IPOctet = "ipoctet" + Attr_ImageID = "image_id" + Attr_ImageInfo = "image_info" + Attr_ImageType = "image_type" + Attr_Images = "images" + Attr_InputVolumes = "input_volumes" + Attr_InstanceSnapshots = "instance_snapshots" + Attr_InstanceVolumes = "instance_volumes" + Attr_Instances = "instances" + Attr_IsActive = "is_active" + Attr_Jumbo = "jumbo" + Attr_Key = "key" + Attr_KeyCreationDate = "creation_date" + Attr_KeyID = "key_id" + Attr_KeyName = "name" + Attr_Keys = "keys" + Attr_Language = "language" + Attr_LastUpdateDate = "last_update_date" + Attr_LastUpdatedDate = "last_updated_date" + Attr_Leases = "leases" + Attr_LicenseRepositoryCapacity = "license_repository_capacity" + Attr_Location = "location" + Attr_MTU = "mtu" + Attr_MacAddress = "macaddress" + Attr_MasterChangedVolumeName = "master_changed_volume_name" + Attr_MasterVolumeName = "master_volume_name" + Attr_Max = "max" + Attr_MaxAllocationSize = "max_allocation_size" + Attr_MaxAvailable = "max_available" + Attr_MaxCoresAvailable = "max_cores_available" + Attr_MaxMem = "maxmem" + Attr_MaxMemoryAvailable = "max_memory_available" + Attr_MaxProc = "maxproc" + Attr_MaxVirtualCores = "max_virtual_cores" + Attr_MaximumStorageAllocation = "max_storage_allocation" + Attr_Members = "members" + Attr_Memory = "memory" + Attr_Message = "message" + Attr_Metered = "metered" + Attr_Min = "min" + Attr_MinMem = "minmem" + Attr_MinProc = "minproc" + Attr_MinVirtualCores = "min_virtual_cores" + Attr_MirroringState = "mirroring_state" + Attr_Name = "name" + Attr_NetworkID = "network_id" + Attr_NetworkName = "network_name" + Attr_NetworkPorts = "network_ports" + Attr_Networks = "networks" + Attr_NumberOfVolumes = "number_of_volumes" + Attr_Onboardings = "onboardings" + Attr_OperatingSystem = "operating_system" + Attr_PVMInstanceID = "pvm_instance_id" + Attr_PVMInstances = "pvm_instances" + Attr_PVMSnapshots = "pvm_snapshots" + Attr_PercentComplete = "percent_complete" + Attr_PinPolicy = "pin_policy" + Attr_PlacementGroupID = "placement_group_id" + Attr_PlacementGroups = "placement_groups" + Attr_Policy = "policy" + Attr_Pool = "pool" + Attr_PoolName = "pool_name" + Attr_Port = "port" + Attr_PortID = "portid" + Attr_PrimaryRole = "primary_role" + Attr_ProcType = "proctype" + Attr_Processors = "processors" + Attr_ProfileID = "profile_id" + Attr_Profiles = "profiles" + Attr_Progress = "progress" + Attr_PublicIP = "public_ip" + Attr_Region = "region" + Attr_RemoteCopyID = "remote_copy_id" + Attr_RemoteCopyRelationshipNames = "remote_copy_relationship_names" + Attr_RemoteCopyRelationships = "remote_copy_relationships" + Attr_ReplicationEnabled = "replication_enabled" + Attr_ReplicationSites = "replication_sites" + Attr_ReplicationStatus = "replication_status" + Attr_ReplicationType = "replication_type" + Attr_ReservedCores = "reserved_cores" + Attr_ResultsOnboardedVolumes = "results_onboarded_volumes" + Attr_ResultsVolumeOnboardingFailures = "results_volume_onboarding_failures" + Attr_SPPPlacementGroups = "spp_placement_groups" + Attr_SSHKey = "ssh_key" + Attr_Shareable = "shreable" + Attr_SharedCoreRatio = "shared_core_ratio" + Attr_SharedProcessorPool = "shared_processor_pool" + Attr_SharedProcessorPoolID = "shared_processor_pool_id" + Attr_SharedProcessorPoolPlacementGroups = "spp_placement_groups" + Attr_SharedProcessorPoolStatus = "status" + Attr_SharedProcessorPools = "shared_processor_pools" + Attr_SharedProcessorPoolName = "name" + Attr_SharedProcessorPoolHostID = "host_id" + Attr_SharedProcessorPoolReservedCores = "reserved_cores" + Attr_SharedProcessorPoolAvailableCores = "available_cores" + Attr_SharedProcessorPoolAllocatedCores = "allocated_cores" + Attr_SharedProcessorPoolStatusDetail = "status_detail" + Attr_SharedProcessorPoolInstances = "instances" + Attr_SharedProcessorPoolInstanceCpus = "cpus" + Attr_SharedProcessorPoolInstanceUncapped = "uncapped" + Attr_SharedProcessorPoolInstanceAvailabilityZone = "availability_zone" + Attr_SharedProcessorPoolInstanceId = "id" + Attr_SharedProcessorPoolInstanceMemory = "memory" + Attr_SharedProcessorPoolInstanceName = "name" + Attr_SharedProcessorPoolInstanceStatus = "status" + Attr_SharedProcessorPoolInstanceVcpus = "vcpus" + Attr_Size = "size" + Attr_SourceVolumeName = "source_volume_name" + Attr_Speed = "speed" + Attr_StartTime = "start_time" + Attr_State = "state" + Attr_Status = "status" + Attr_StatusDescriptionErrors = "status_description_errors" + Attr_StatusDetail = "status_detail" + Attr_StoragePool = "storage_pool" + Attr_StoragePoolAffinity = "storage_pool_affinity" + Attr_StoragePoolsCapacity = "storage_pools_capacity" + Attr_StorageType = "storage_type" + Attr_StorageTypesCapacity = "storage_types_capacity" + Attr_Synchronized = "synchronized" + Attr_SysType = "systype" + Attr_SystemPoolName = "system_pool_name" + Attr_SystemPools = "system_pools" + Attr_Systems = "systems" + Attr_TargetVolumeName = "target_volume_name" + Attr_TenantID = "tenant_id" + Attr_TenantName = "tenant_name" + Attr_TotalCapacity = "total_capacity" + Attr_TotalInstances = "total_instances" + Attr_TotalMemoryConsumed = "total_memory_consumed" + Attr_TotalProcessorsConsumed = "total_processors_consumed" + Attr_TotalSSDStorageConsumed = "total_ssd_storage_consumed" + Attr_TotalStandardStorageConsumed = "total_standard_storage_consumed" + Attr_Type = "type" + Attr_URL = "url" + Attr_Uncapped = "uncapped" + Attr_UsedIPCount = "used_ip_count" + Attr_UsedIPPercent = "used_ip_percent" + Attr_UserIPAddress = "user_ip_address" + Attr_VCPUs = "vcpus" + Attr_VLanID = "vlan_id" + Attr_VPCCRNs = "vpc_crns" + Attr_VPCEnabled = "vpc_enabled" + Attr_VirtualCoresAssigned = "virtual_cores_assigned" + Attr_VolumeGroupName = "volume_group_name" + Attr_VolumeGroups = "volume_groups" + Attr_VolumeIDs = "volume_ids" + Attr_VolumePool = "volume_pool" + Attr_VolumeSnapshots = "volume_snapshots" + Attr_Volumes = "volumes" + Attr_WWN = "wwn" + Attr_Workspaces = "workspaces" - Attr_KeyID = "key_id" - Attr_Keys = "keys" - Attr_KeyCreationDate = "creation_date" - Attr_Key = "ssh_key" - Attr_KeyName = "name" + // TODO: Second Half Cleanup, remove extra variables // SAP Profile PISAPProfiles = "profiles" @@ -47,10 +282,6 @@ const ( Arg_PVMInstanceActionType = "pi_action" Arg_PVMInstanceHealthStatus = "pi_health_status" - Attr_Status = "status" - Attr_Progress = "progress" - Attr_HealthStatus = "health_status" - PVMInstanceHealthOk = "OK" PVMInstanceHealthWarning = "WARNING" @@ -58,16 +289,33 @@ const ( warningTimeOut = 60 * time.Second activeTimeOut = 2 * time.Minute // power service instance capabilities - CUSTOM_VIRTUAL_CORES = "custom-virtualcores" - PIInstanceDeploymentType = "pi_deployment_type" - PIInstanceNetwork = "pi_network" - PIInstanceStoragePool = "pi_storage_pool" - PISAPInstanceProfileID = "pi_sap_profile_id" - PISAPInstanceDeploymentType = "pi_sap_deployment_type" - PIInstanceStoragePoolAffinity = "pi_storage_pool_affinity" - Arg_PIInstanceSharedProcessorPool = "pi_shared_processor_pool" + CUSTOM_VIRTUAL_CORES = "custom-virtualcores" + + PICloudConnectionId = "cloud_connection_id" + PICloudConnectionStatus = "status" + PICloudConnectionIBMIPAddress = "ibm_ip_address" + PICloudConnectionUserIPAddress = "user_ip_address" + PICloudConnectionPort = "port" + PICloudConnectionClassicGreSource = "gre_source_address" + PICloudConnectionConnectionMode = "connection_mode" + PIInstanceDeploymentType = "pi_deployment_type" + PIInstanceMigratable = "pi_migratable" + PIInstanceNetwork = "pi_network" + PIInstanceLicenseRepositoryCapacity = "pi_license_repository_capacity" + PIInstanceStoragePool = "pi_storage_pool" + PIInstanceStorageType = "pi_storage_type" + PISAPInstanceProfileID = "pi_sap_profile_id" + PISAPInstanceDeploymentType = "pi_sap_deployment_type" + PIInstanceSharedProcessorPool = "pi_shared_processor_pool" + PIInstanceStorageConnection = "pi_storage_connection" + PIInstanceStoragePoolAffinity = "pi_storage_pool_affinity" + + PIInstanceUserData = "pi_user_data" + PIInstanceVolumeIds = "pi_volume_ids" + Attr_PIInstanceSharedProcessorPool = "shared_processor_pool" Attr_PIInstanceSharedProcessorPoolID = "shared_processor_pool_id" + Arg_PIInstanceSharedProcessorPool = "pi_shared_processor_pool" // Placement Group PIPlacementGroupID = "placement_group_id" @@ -104,37 +352,10 @@ const ( // Cloud Connections PICloudConnectionTransitEnabled = "pi_cloud_connection_transit_enabled" - // Shared Processor Pool - Arg_SharedProcessorPoolName = "pi_shared_processor_pool_name" - Arg_SharedProcessorPoolHostGroup = "pi_shared_processor_pool_host_group" - Arg_SharedProcessorPoolPlacementGroupID = "pi_shared_processor_pool_placement_group_id" - Arg_SharedProcessorPoolReservedCores = "pi_shared_processor_pool_reserved_cores" - Arg_SharedProcessorPoolID = "pi_shared_processor_pool_id" - Attr_SharedProcessorPoolID = "shared_processor_pool_id" - Attr_SharedProcessorPoolName = "name" - Attr_SharedProcessorPoolReservedCores = "reserved_cores" - Attr_SharedProcessorPoolAvailableCores = "available_cores" - Attr_SharedProcessorPoolAllocatedCores = "allocated_cores" - Attr_SharedProcessorPoolHostID = "host_id" - Attr_SharedProcessorPoolStatus = "status" - Attr_SharedProcessorPoolStatusDetail = "status_detail" - Attr_SharedProcessorPoolPlacementGroups = "spp_placement_groups" - Attr_SharedProcessorPoolInstances = "instances" - Attr_SharedProcessorPoolInstanceCpus = "cpus" - Attr_SharedProcessorPoolInstanceUncapped = "uncapped" - Attr_SharedProcessorPoolInstanceAvailabilityZone = "availability_zone" - Attr_SharedProcessorPoolInstanceId = "id" - Attr_SharedProcessorPoolInstanceMemory = "memory" - Attr_SharedProcessorPoolInstanceName = "name" - Attr_SharedProcessorPoolInstanceStatus = "status" - Attr_SharedProcessorPoolInstanceVcpus = "vcpus" - // SPP Placement Group - Arg_SPPPlacementGroupName = "pi_spp_placement_group_name" - Arg_SPPPlacementGroupPolicy = "pi_spp_placement_group_policy" + Attr_SPPPlacementGroupID = "spp_placement_group_id" Attr_SPPPlacementGroupMembers = "members" - Arg_SPPPlacementGroupID = "pi_spp_placement_group_id" Attr_SPPPlacementGroupPolicy = "policy" Attr_SPPPlacementGroupName = "name" diff --git a/website/docs/d/pi_cloud_connection.html.markdown b/website/docs/d/pi_cloud_connection.html.markdown index ca42eb4117..2e6de4d4bd 100644 --- a/website/docs/d/pi_cloud_connection.html.markdown +++ b/website/docs/d/pi_cloud_connection.html.markdown @@ -7,11 +7,9 @@ description: |- --- # ibm_pi_cloud_connection - Retrieve information about an existing IBM Cloud Power Virtual Server Cloud cloud connection. For more information, about IBM power virtual server cloud, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). ## Example usage - ```terraform data "ibm_pi_cloud_connection" "example" { pi_cloud_connection_name = "test_cloud_connection" @@ -20,15 +18,12 @@ data "ibm_pi_cloud_connection" "example" { ``` **Notes** - - Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. - If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: - - `region` - `lon` - `zone` - `lon04` - Example usage: - +Example usage: ```terraform provider "ibm" { region = "lon" @@ -37,28 +32,26 @@ data "ibm_pi_cloud_connection" "example" { ``` ## Argument reference - Review the argument references that you can specify for your data source. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. - `pi_cloud_connection_name` - (Required, String) The cloud connection name to be used. ## Attribute reference - In addition to all argument reference list, you can access the following attribute references after your data source is created. -- `id` - (String) The unique identifier of the cloud connection. -- `classic_enabled` - (Bool) Is classic endpoint destination enabled? +- `classic_enabled` - (Boolean) Enable classic endpoint destination. - `connection_mode` - (String) Type of service the gateway is attached to. -- `global_routing` - (String) Is global routing enabled for this cloud connection. -- `gre_destination_address` - (String) The GRE destination IP address. -- `gre_source_address` - (String) The GRE auto-assigned source IP address. +- `global_routing` - (String) Enable global routing for this cloud connection. +- `gre_destination_address` - (String) GRE destination IP address. +- `gre_source_address` - (String) GRE auto-assigned source IP address. +- `id` - (String) The unique identifier of the cloud connection. - `ibm_ip_address` - (String) The IBM IP address. -- `metered` - (String) Is metered enabled for this cloud connection. -- `networks` - (Set of String) Set of Networks attached to this cloud connection. +- `metered` - (String) Enable metering for this cloud connection. +- `networks` - (Set) Set of Networks attached to this cloud connection. - `port` - (String) Port. - `speed` - (Integer) Speed of the cloud connection (speed in megabits per second). - `status` - (String) Link status. - `user_ip_address` - (String) User IP address. -- `vpc_crns` - (Set of String) Set of VPCs attached to this cloud connection. -- `vpc_enabled` - (Bool) Is VPC enabled for this cloud connection? +- `vpc_crns` - (Set) Set of VPCs attached to this cloud connection. +- `vpc_enabled` - (Boolean) Enable VPC for this cloud connection. diff --git a/website/docs/d/pi_cloud_connections.html.markdown b/website/docs/d/pi_cloud_connections.html.markdown index 8925fd81e6..0ab04e36da 100644 --- a/website/docs/d/pi_cloud_connections.html.markdown +++ b/website/docs/d/pi_cloud_connections.html.markdown @@ -7,11 +7,9 @@ description: |- --- # ibm_pi_cloud_connections - Retrieve information about all cloud connections as a read-only data source. For more information, about IBM power virtual server cloud, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). ## Example usage - ```terraform data "ibm_pi_cloud_connections" "example" { pi_cloud_instance_id = "" @@ -19,15 +17,13 @@ data "ibm_pi_cloud_connections" "example" { ``` **Notes** - - Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. - If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: - `region` - `lon` - `zone` - `lon04` - Example usage: - +Example usage: ```terraform provider "ibm" { region = "lon" @@ -36,32 +32,29 @@ data "ibm_pi_cloud_connections" "example" { ``` ## Argument reference - Review the argument references that you can specify for your data source. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. ## Attribute reference - In addition to all argument reference list, you can access the following attribute references after your data source is created. - `connections` - (List) List of all the Cloud Connections. Nested scheme for `connections`: - - - `classic_enabled` - (Bool) Is Classic endpoint destination enabled. + - `classic_enabled` - (Boolean) Enable classic endpoint destination. - `cloud_connection_id` - (String) The unique identifier of the cloud connection. - - `global_routing` - (String) Is global routing enabled for this cloud connection. + - `connection_mode` - (String) Type of service the gateway is attached to. + - `global_routing` - (String) Enable global routing for this cloud connection. - `gre_destination_address` - (String) GRE destination IP address. - `gre_source_address` - (String) GRE auto-assigned source IP address. - `ibm_ip_address` - (String) IBM IP address. - - `metered` - (String) Is metered enabled for this cloud connection. + - `metered` - (String) Enable metering for this cloud connection. - `name` - (String) Name of the cloud connection. - - `networks` - (Set of String) Set of Networks attached to this cloud connection. + - `networks` - (Set) Set of Networks attached to this cloud connection. - `port` - (String) Port. - `speed` - (Integer) Speed of the cloud connection (speed in megabits per second). - `status` - (String) Link status. - `user_ip_address` - (String) User IP address. - - `vpc_crns` - (Set of String) Set of VPCs attached to this cloud connection. - - `vpc_enabled` - (Bool) Is VPC enabled for this cloud connection. - - `connection_mode` - (String) Type of service the gateway is attached to. + - `vpc_crns` - (Set) Set of VPCs attached to this cloud connection. + - `vpc_enabled` - (Boolean) Enable VPC for this cloud connection.