diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index 175899fecb..150b5b3ce2 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -1604,6 +1604,14 @@ func resourceIBMDatabaseInstanceRead(context context.Context, d *schema.Resource if endpoint, ok := instance.Parameters["service-endpoints"]; ok { d.Set("service_endpoints", endpoint) } + + if encryptionInstance, ok := instance.Parameters["disk_encryption_instance_crn"]; ok { + d.Set("key_protect_instance", encryptionInstance) + } + + if encryptionKey, ok := instance.Parameters["disk_encryption_key_crn"]; ok { + d.Set("key_protect_key", encryptionKey) + } } d.Set(flex.ResourceName, *instance.Name) diff --git a/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go b/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go index 6d9e3e655b..3191ee5e99 100644 --- a/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go +++ b/ibm/service/database/resource_ibm_database_elasticsearch_platinum_test.go @@ -274,7 +274,7 @@ func TestAccIBMDatabaseInstanceElasticsearchPlatinumImport(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes", "plan_validation"}, + "wait_time_minutes", "plan_validation", "deletion_protection"}, }, }, }) diff --git a/ibm/service/database/resource_ibm_database_elasticsearch_test.go b/ibm/service/database/resource_ibm_database_elasticsearch_test.go index 763f450be7..0966bdc52c 100644 --- a/ibm/service/database/resource_ibm_database_elasticsearch_test.go +++ b/ibm/service/database/resource_ibm_database_elasticsearch_test.go @@ -271,7 +271,7 @@ func TestAccIBMDatabaseInstanceElasticsearchImport(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes"}, + "wait_time_minutes", "deletion_protection"}, }, }, }) diff --git a/ibm/service/database/resource_ibm_database_etcd_test.go b/ibm/service/database/resource_ibm_database_etcd_test.go index 236dc8811e..edc988e529 100644 --- a/ibm/service/database/resource_ibm_database_etcd_test.go +++ b/ibm/service/database/resource_ibm_database_etcd_test.go @@ -101,7 +101,7 @@ func TestAccIBMDatabaseInstanceEtcdImport(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes"}, + "wait_time_minutes", "deletion_protection"}, }, }, }) diff --git a/ibm/service/database/resource_ibm_database_postgresql_test.go b/ibm/service/database/resource_ibm_database_postgresql_test.go index a8c6453c0a..2718d3b6ba 100644 --- a/ibm/service/database/resource_ibm_database_postgresql_test.go +++ b/ibm/service/database/resource_ibm_database_postgresql_test.go @@ -210,7 +210,7 @@ func TestAccIBMDatabaseInstancePostgresImport(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes"}, + "wait_time_minutes", "deletion_protection"}, }, }, }) diff --git a/ibm/service/database/resource_ibm_database_rabbitmq_test.go b/ibm/service/database/resource_ibm_database_rabbitmq_test.go index 1ac4e88cca..3023b452be 100644 --- a/ibm/service/database/resource_ibm_database_rabbitmq_test.go +++ b/ibm/service/database/resource_ibm_database_rabbitmq_test.go @@ -108,7 +108,7 @@ func TestAccIBMDatabaseInstanceRabbitmqImport(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes"}, + "wait_time_minutes", "deletion_protection"}, }, }, }) diff --git a/ibm/service/database/resource_ibm_database_redis_test.go b/ibm/service/database/resource_ibm_database_redis_test.go index 26307c74d9..fa51bbe888 100644 --- a/ibm/service/database/resource_ibm_database_redis_test.go +++ b/ibm/service/database/resource_ibm_database_redis_test.go @@ -113,7 +113,7 @@ func TestAccIBMDatabaseInstanceRedisImport(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_time_minutes"}, + "wait_time_minutes", "deletion_protection"}, }, }, }) diff --git a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template.go b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template.go index 1bd1d31f29..a653a77a38 100644 --- a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template.go +++ b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template.go @@ -388,6 +388,17 @@ func resourceIBMIAMAccessGroupTemplateCreate(context context.Context, d *schema. } version, _ := strconv.Atoi(*templateResponse.Version) + if d.Get("committed").(bool) { + commitTemplateOptions := &iamaccessgroupsv2.CommitTemplateOptions{} + commitTemplateOptions.SetTemplateID(*templateResponse.ID) + commitTemplateOptions.SetVersionNum(*templateResponse.Version) + commitTemplateOptions.SetIfMatch(response.Headers.Get("ETag")) + response, err = iamAccessGroupsClient.CommitTemplateWithContext(context, commitTemplateOptions) + if err != nil { + log.Printf("[DEBUG] CommitTemplateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CommitTemplateWithContext failed %s\n%s", err, response)) + } + } d.SetId(fmt.Sprintf("%s/%d", *templateResponse.ID, version)) return resourceIBMIAMAccessGroupTemplateVersionRead(context, d, meta) diff --git a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_test.go b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_test.go index b8a6cc9f11..78902bba8d 100644 --- a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_test.go +++ b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_test.go @@ -35,6 +35,7 @@ func TestAccIBMIAMAccessGroupTemplateBasic(t *testing.T) { testAccCheckIBMIAMAccessGroupTemplateVersionExists("ibm_iam_access_group_template.template", conf), resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "name", name), resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "group.0.name", agName), + resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "committed", "true"), ), }, }, @@ -106,6 +107,7 @@ func testAccCheckIBMIAMAccessGroupTemplateConfigBasic(name string, agName string group { name = "%s" } + committed = true } `, name, agName) } diff --git a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version.go b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version.go index 33245b0da6..a9a0ced3c0 100644 --- a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version.go +++ b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version.go @@ -390,6 +390,18 @@ func resourceIBMIAMAccessGroupTemplateVersionCreate(context context.Context, d * return diag.FromErr(fmt.Errorf("CreateTemplateVersionWithContext failed %s\n%s", err, response)) } + if d.Get("committed").(bool) { + commitTemplateOptions := &iamaccessgroupsv2.CommitTemplateOptions{} + commitTemplateOptions.SetTemplateID(*templateVersionResponse.ID) + commitTemplateOptions.SetVersionNum(*templateVersionResponse.Version) + commitTemplateOptions.SetIfMatch(response.Headers.Get("ETag")) + response, err = iamAccessGroupsClient.CommitTemplateWithContext(context, commitTemplateOptions) + if err != nil { + log.Printf("[DEBUG] CommitTemplateWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("CommitTemplateWithContext failed %s\n%s", err, response)) + } + } + d.SetId(fmt.Sprintf("%s/%s", *templateVersionResponse.ID, *templateVersionResponse.Version)) return resourceIBMIAMAccessGroupTemplateVersionRead(context, d, meta) diff --git a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version_test.go b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version_test.go index cd0584ff31..7f27f48196 100644 --- a/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version_test.go +++ b/ibm/service/iamaccessgroup/resource_ibm_iam_access_group_template_version_test.go @@ -36,6 +36,7 @@ func TestAccIBMIAMAccessGroupTemplateVersion(t *testing.T) { resource.TestCheckResourceAttr("ibm_iam_access_group_template_version.template", "group.0.name", versionAGName), resource.TestCheckResourceAttr("ibm_iam_access_group_template_version.template", "name", name), resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "name", name), + resource.TestCheckResourceAttr("ibm_iam_access_group_template_version.template", "committed", "true"), ), }, }, @@ -52,7 +53,7 @@ func TestAccIBMIAMAccessGroupTemplateVersionUpdateWithCommit(t *testing.T) { CheckDestroy: testAccCheckIBMIAMAccessGroupTemplateVersionDestroy, Steps: []resource.TestStep{ { - Config: testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasic(name, agName, versionAGName), + Config: testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasicWithoutCommit(name, agName, versionAGName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckIBMIAMAccessGroupTemplateVersionExists("ibm_iam_access_group_template_version.template", conf), resource.TestCheckResourceAttr("ibm_iam_access_group_template.template", "group.0.name", agName), @@ -87,6 +88,34 @@ func testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasic(name string, agName } } + resource "ibm_iam_access_group_template_version" "template" { + template_id = ibm_iam_access_group_template.template.template_id + name = ibm_iam_access_group_template.template.name + description = "Testing4" + group { + name = "%s" + assertions { + action_controls { + add = false + remove = true + } + } + } + committed = true + } + `, name, agName, versionAGName) +} + +func testAccCheckIBMIAMAccessGroupTemplateVersionConfigBasicWithoutCommit(name string, agName string, versionAGName string) string { + return fmt.Sprintf(` + resource "ibm_iam_access_group_template" "template" { + name = "%s" + description = "Test Terraform Description" + group { + name = "%s" + } + } + resource "ibm_iam_access_group_template_version" "template" { template_id = ibm_iam_access_group_template.template.template_id name = ibm_iam_access_group_template.template.name diff --git a/ibm/service/power/data_source_ibm_pi_sap_profile.go b/ibm/service/power/data_source_ibm_pi_sap_profile.go index a1e04e803f..4535706116 100644 --- a/ibm/service/power/data_source_ibm_pi_sap_profile.go +++ b/ibm/service/power/data_source_ibm_pi_sap_profile.go @@ -107,7 +107,7 @@ func dataSourceIBMPISAPProfileRead(ctx context.Context, d *schema.ResourceData, d.Set(Attr_SAPS, sapProfile.Saps) d.Set(Attr_SupportedSystems, sapProfile.SupportedSystems) d.Set(Attr_Type, *sapProfile.Type) - d.Set(Attr_WorkloadType, *&sapProfile.WorkloadTypes) + d.Set(Attr_WorkloadType, sapProfile.WorkloadTypes) return nil } diff --git a/ibm/service/power/data_source_ibm_pi_sap_profiles.go b/ibm/service/power/data_source_ibm_pi_sap_profiles.go index 7517694019..d345e6dcea 100644 --- a/ibm/service/power/data_source_ibm_pi_sap_profiles.go +++ b/ibm/service/power/data_source_ibm_pi_sap_profiles.go @@ -118,7 +118,7 @@ func dataSourceIBMPISAPProfilesRead(ctx context.Context, d *schema.ResourceData, Attr_SAPS: sapProfile.Saps, Attr_SupportedSystems: sapProfile.SupportedSystems, Attr_Type: *sapProfile.Type, - Attr_WorkloadType: *&sapProfile.WorkloadTypes, + Attr_WorkloadType: sapProfile.WorkloadTypes, } result = append(result, profile) } diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index dc44d0f938..b8313de78c 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -83,6 +83,7 @@ const ( Arg_SharedProcessorPoolID = "pi_shared_processor_pool_id" Arg_SharedProcessorPoolName = "pi_shared_processor_pool_name" Arg_SharedProcessorPoolPlacementGroupID = "pi_shared_processor_pool_placement_group_id" + Arg_SharedProcessorPoolPlacementGroups = "pi_shared_processor_pool_placement_groups" Arg_SharedProcessorPoolReservedCores = "pi_shared_processor_pool_reserved_cores" Arg_SnapshotID = "pi_snapshot_id" Arg_SnapShotName = "pi_snap_shot_name" @@ -118,341 +119,317 @@ const ( Arg_VolumeType = "pi_volume_type" Arg_VTL = "vtl" - // Duplicate Arguments, will be removed as refactoring take course. - PIVolumeGroupID = "pi_volume_group_id" - PIVolumeOnboardingID = "pi_volume_onboarding_id" - // Attributes - Attr_Access = "access" - Attr_AccessConfig = "access_config" - Attr_Action = "action" - Attr_Addresses = "addresses" - Attr_AllocatedCores = "allocated_cores" - Attr_Architecture = "architecture" - Attr_AsynchronousReplication = "asynchronous_replication" - Attr_Auxiliary = "auxiliary" - Attr_AuxiliaryChangedVolumeName = "auxiliary_changed_volume_name" - Attr_AuxiliaryVolumeName = "auxiliary_volume_name" - Attr_AvailabilityZone = "availability_zone" - Attr_AvailableCores = "available_cores" - Attr_AvailableHosts = "available_hosts" - Attr_AvailableIPCount = "available_ip_count" - Attr_AvailableMemory = "available_memory" - Attr_Bootable = "bootable" - Attr_BootVolumeID = "boot_volume_id" - Attr_Capabilities = "capabilities" - Attr_CapabilityDetails = "capability_details" - Attr_Capacity = "capacity" - Attr_Certified = "certified" - Attr_CIDR = "cidr" - Attr_ClassicEnabled = "classic_enabled" - Attr_ClonedVolumes = "clone_volumes" - Attr_CloneVolumeID = "clone_volume_id" - 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_Count = "count" - Attr_CPUs = "cpus" - Attr_Created = "created" - Attr_CreateTime = "create_time" - Attr_CreationDate = "creation_date" - Attr_CRN = "crn" - Attr_CyclePeriodSeconds = "cycle_period_seconds" - Attr_CyclingMode = "cycling_mode" - Attr_DatacenterCapabilities = "pi_datacenter_capabilities" - Attr_DatacenterHref = "pi_datacenter_href" - Attr_DatacenterLocation = "pi_datacenter_location" - Attr_Datacenters = "datacenters" - Attr_DatacenterStatus = "pi_datacenter_status" - Attr_DatacenterType = "pi_datacenter_type" - Attr_Dedicated = "dedicated" - Attr_Default = "default" - Attr_DeleteOnTermination = "delete_on_termination" - Attr_DeploymentType = "deployment_type" - Attr_Description = "description" - Attr_DestinationPort = "destination_port" - Attr_Details = "details" - Attr_DhcpID = "dhcp_id" - Attr_DhcpManaged = "dhcp_managed" - Attr_Direction = "direction" - Attr_DisasterRecovery = "disaster_recovery" - Attr_DisasterRecoveryLocations = "disaster_recovery_locations" - Attr_DiskFormat = "disk_format" - Attr_DiskType = "disk_type" - Attr_DisplayName = "display_name" - Attr_DNS = "dns" - Attr_Enabled = "enabled" - Attr_Endianness = "endianness" - Attr_ExternalIP = "external_ip" - Attr_FailureMessage = "failure_message" - Attr_FailureReason = "failure_reason" - Attr_Fault = "fault" - Attr_Flag = "flag" - Attr_FlashCopyMappings = "flash_copy_mappings" - Attr_FlashCopyName = "flash_copy_name" - Attr_FreezeTime = "freeze_time" - Attr_FullSystemProfile = "full_system_profile" - Attr_Gateway = "gateway" - Attr_General = "general" - Attr_GlobalRouting = "global_routing" - Attr_GreDestinationAddress = "gre_destination_address" - Attr_GreSourceAddress = "gre_source_address" - Attr_GroupID = "group_id" - Attr_HealthStatus = "health_status" - Attr_HostGroup = "host_group" - Attr_HostGroupID = "host_group_id" - Attr_HostGroups = "host_groups" - Attr_HostID = "host_id" - Attr_Hosts = "hosts" - Attr_Href = "href" - Attr_Hypervisor = "hypervisor" - Attr_HypervisorType = "hypervisor_type" - Attr_IBMiCSS = "ibmi_css" - Attr_IBMIPAddress = "ibm_ip_address" - Attr_IBMiPHA = "ibmi_pha" - Attr_IBMiRDS = "ibmi_rds" - Attr_IBMiRDSUsers = "ibmi_rds_users" - Attr_ICMPType = "icmp_type" - Attr_ID = "id" - Attr_ImageID = "image_id" - Attr_ImageInfo = "image_info" - Attr_Images = "images" - Attr_ImageType = "image_type" - Attr_InputVolumes = "input_volumes" - Attr_Instance = "instance" - Attr_InstanceID = "instance_id" - Attr_InstanceIP = "instance_ip" - Attr_InstanceMac = "instance_mac" - Attr_Instances = "instances" - Attr_InstanceSnapshots = "instance_snapshots" - Attr_InstanceVolumes = "instance_volumes" - Attr_Interfaces = "interfaces" - Attr_IOThrottleRate = "io_throttle_rate" - Attr_IP = "ip" - Attr_IPAddress = "ip_address" - Attr_IPaddress = "ipaddress" - Attr_IPOctet = "ipoctet" - Attr_IsActive = "is_active" - Attr_Jumbo = "jumbo" - Attr_Key = "key" - Attr_KeyCreationDate = "creation_date" - Attr_KeyID = "key_id" - 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_LicenseType = "license_type" - Attr_Location = "location" - Attr_MacAddress = "mac_address" - 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_Maximum = "maximum" - Attr_MaximumStorageAllocation = "max_storage_allocation" - Attr_MaxMem = "maxmem" - Attr_MaxMemory = "max_memory" - Attr_MaxMemoryAvailable = "max_memory_available" - Attr_MaxProc = "maxproc" - Attr_MaxProcessors = "max_processors" - Attr_MaxVirtualCores = "max_virtual_cores" - Attr_Members = "members" - Attr_Memory = "memory" - Attr_Message = "message" - Attr_Metered = "metered" - Attr_MigrationStatus = "migration_status" - Attr_Min = "min" - Attr_Minimum = "minimum" - Attr_MinMem = "minmem" - Attr_MinMemory = "min_memory" - Attr_MinProc = "minproc" - Attr_MinProcessors = "min_processors" - Attr_MinVirtualCores = "min_virtual_cores" - Attr_MirroringState = "mirroring_state" - Attr_MTU = "mtu" - Attr_Name = "name" - Attr_NetworkAddressGroupID = "network_address_group_id" - Attr_NetworkAddressGroupMemberID = "network_address_group_member_id" - Attr_NetworkAddressGroups = "network_address_groups" - Attr_NetworkID = "network_id" - Attr_NetworkInterfaceID = "network_interface_id" - Attr_NetworkName = "network_name" - Attr_NetworkPorts = "network_ports" - Attr_NetworkPortID = "network_port_id" - Attr_Networks = "networks" - Attr_NetworkSecurityGroupID = "network_security_group_id" - Attr_NetworkSecurityGroupMemberID = "network_security_group_member_id" - Attr_NetworkSecurityGroups = "network_security_groups" - Attr_NumberOfVolumes = "number_of_volumes" - Attr_Onboardings = "onboardings" - Attr_OperatingSystem = "operating_system" - Attr_OSType = "os_type" - 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_PowerEdgeRouter = "power_edge_router" - Attr_Primary = "primary" - Attr_PrimaryRole = "primary_role" - Attr_Processors = "processors" - Attr_ProcType = "proctype" - Attr_Product = "product" - Attr_ProfileID = "profile_id" - Attr_Profiles = "profiles" - Attr_Progress = "progress" - Attr_Protocol = "protocol" - Attr_PublicIP = "public_ip" - Attr_PVMInstanceID = "pvm_instance_id" - Attr_PVMInstances = "pvm_instances" - Attr_PVMSnapshots = "pvm_snapshots" - Attr_Region = "region" - Attr_RegionStorageTiers = "region_storage_tiers" - Attr_Remote = "remote" - Attr_RemoteCopyID = "remote_copy_id" - Attr_RemoteCopyRelationshipNames = "remote_copy_relationship_names" - Attr_RemoteCopyRelationships = "remote_copy_relationships" - Attr_RemotePool = "remote_pool" - Attr_ReplicationEnabled = "replication_enabled" - Attr_ReplicationPoolMap = "replication_pool_map" - Attr_ReplicationServices = "replication_services" - Attr_ReplicationSites = "replication_sites" - Attr_ReplicationStatus = "replication_status" - Attr_ReplicationType = "replication_type" - Attr_ReservedCore = "reserved_core" - Attr_ReservedCores = "reserved_cores" - Attr_ReservedMemory = "reserved_memory" - Attr_ResultsOnboardedVolumes = "results_onboarded_volumes" - Attr_ResultsVolumeOnboardingFailures = "results_volume_onboarding_failures" - Attr_Rules = "rules" - Attr_SAPS = "saps" - Attr_Secondaries = "secondaries" - Attr_ServerName = "server_name" - Attr_Servers = "servers" - Attr_Shareable = "shreable" - Attr_SharedCoreRatio = "shared_core_ratio" - Attr_SharedProcessorPool = "shared_processor_pool" - Attr_SharedProcessorPoolAllocatedCores = "allocated_cores" - Attr_SharedProcessorPoolAvailableCores = "available_cores" - Attr_SharedProcessorPoolHostID = "host_id" - Attr_SharedProcessorPoolID = "shared_processor_pool_id" - Attr_SharedProcessorPoolInstanceAvailabilityZone = "availability_zone" - Attr_SharedProcessorPoolInstanceCpus = "cpus" - Attr_SharedProcessorPoolInstanceId = "id" - Attr_SharedProcessorPoolInstanceMemory = "memory" - Attr_SharedProcessorPoolInstanceName = "name" - Attr_SharedProcessorPoolInstances = "instances" - Attr_SharedProcessorPoolInstanceUncapped = "uncapped" - Attr_SharedProcessorPoolInstanceVcpus = "vcpus" - Attr_SharedProcessorPoolName = "name" - Attr_SharedProcessorPoolPlacementGroups = "spp_placement_groups" - Attr_SharedProcessorPoolReservedCores = "reserved_cores" - Attr_SharedProcessorPools = "shared_processor_pools" - Attr_SharedProcessorPoolStatusDetail = "status_detail" - Attr_Size = "size" - Attr_SnapshotID = "snapshot_id" - Attr_SourceChecksum = "source_checksum" - Attr_SourcePort = "source_port" - Attr_SourceVolumeID = "source_volume_id" - Attr_SourceVolumeName = "source_volume_name" - Attr_Speed = "speed" - Attr_SPPPlacementGroupID = "spp_placement_group_id" - Attr_SPPPlacementGroupMembers = "members" - Attr_SPPPlacementGroupName = "name" - Attr_SPPPlacementGroupPolicy = "policy" - Attr_SPPPlacementGroups = "spp_placement_groups" - Attr_SSHKey = "ssh_key" - Attr_StartTime = "start_time" - Attr_State = "state" - Attr_Status = "status" - Attr_StatusDescriptionErrors = "status_description_errors" - Attr_StatusDetail = "status_detail" - Attr_StorageConnection = "storage_connection" - Attr_StoragePool = "storage_pool" - Attr_StoragePoolAffinity = "storage_pool_affinity" - Attr_StoragePoolsCapacity = "storage_pools_capacity" - Attr_StorageType = "storage_type" - Attr_StorageTypesCapacity = "storage_types_capacity" - Attr_SupportedSystems = "supported_systems" - Attr_Synchronized = "synchronized" - Attr_SynchronousReplication = "synchronous_replication" - Attr_SystemPoolName = "system_pool_name" - Attr_SystemPools = "system_pools" - Attr_Systems = "systems" - Attr_SysType = "sys_type" - Attr_Systype = "systype" - Attr_Target = "target" - Attr_TargetLocations = "target_locations" - Attr_TargetVolumeName = "target_volume_name" - Attr_TaskID = "task_id" - Attr_TCPFlags = "tcp_flags" - Attr_TenantID = "tenant_id" - Attr_TenantName = "tenant_name" - Attr_TotalCapacity = "total_capacity" - Attr_TotalCore = "total_core" - Attr_TotalInstances = "total_instances" - Attr_TotalMemory = "total_memory" - 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_Uncapped = "uncapped" - Attr_UpdatedDate = "updated_date" - Attr_URL = "url" - Attr_UsedCore = "used_core" - Attr_UsedIPCount = "used_ip_count" - Attr_UsedIPPercent = "used_ip_percent" - Attr_UsedMemory = "used_memory" - Attr_UserIPAddress = "user_ip_address" - Attr_UserTags = "user_tags" - Attr_VCPUs = "vcpus" - Attr_Vendor = "vendor" - Attr_VirtualCoresAssigned = "virtual_cores_assigned" - Attr_VLanID = "vlan_id" - Attr_VolumeGroupID = "volume_group_id" - Attr_VolumeGroupName = "volume_group_name" - Attr_VolumeGroups = "volume_groups" - Attr_VolumeGroupStatus = "volume_group_status" - Attr_VolumeID = "volume_id" - Attr_VolumeIDs = "volume_ids" - Attr_VolumePool = "volume_pool" - Attr_Volumes = "volumes" - Attr_VolumeSnapshots = "volume_snapshots" - Attr_VolumesSnapshots = "volume_snapshots" - Attr_VolumeStatus = "volume_status" - Attr_VPCCRNs = "vpc_crns" - Attr_VPCEnabled = "vpc_enabled" - Attr_WorkloadType = "workload_type" - Attr_Workspace = "workspace" - Attr_WorkspaceCapabilities = "pi_workspace_capabilities" - Attr_WorkspaceDetails = "pi_workspace_details" - Attr_WorkspaceID = "pi_workspace_id" - Attr_WorkspaceLocation = "pi_workspace_location" - Attr_WorkspaceName = "pi_workspace_name" - Attr_Workspaces = "workspaces" - Attr_WorkspaceStatus = "pi_workspace_status" - Attr_WorkspaceType = "pi_workspace_type" - Attr_WWN = "wwn" + Attr_Access = "access" + Attr_AccessConfig = "access_config" + Attr_Action = "action" + Attr_AllocatedCores = "allocated_cores" + Attr_Architecture = "architecture" + Attr_AsynchronousReplication = "asynchronous_replication" + Attr_Auxiliary = "auxiliary" + Attr_AuxiliaryChangedVolumeName = "auxiliary_changed_volume_name" + Attr_AuxiliaryVolumeName = "auxiliary_volume_name" + Attr_AvailabilityZone = "availability_zone" + Attr_AvailableCores = "available_cores" + Attr_AvailableHosts = "available_hosts" + Attr_AvailableIPCount = "available_ip_count" + Attr_AvailableMemory = "available_memory" + Attr_Bootable = "bootable" + Attr_BootVolumeID = "boot_volume_id" + Attr_Capabilities = "capabilities" + Attr_CapabilityDetails = "capability_details" + Attr_Capacity = "capacity" + Attr_Certified = "certified" + Attr_CIDR = "cidr" + Attr_ClassicEnabled = "classic_enabled" + Attr_ClonedVolumes = "clone_volumes" + Attr_CloneVolumeID = "clone_volume_id" + 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_Count = "count" + Attr_CPUs = "cpus" + Attr_Created = "created" + Attr_CreateTime = "create_time" + Attr_CreationDate = "creation_date" + Attr_CRN = "crn" + Attr_CyclePeriodSeconds = "cycle_period_seconds" + Attr_CyclingMode = "cycling_mode" + Attr_DatacenterCapabilities = "pi_datacenter_capabilities" + Attr_DatacenterHref = "pi_datacenter_href" + Attr_DatacenterLocation = "pi_datacenter_location" + Attr_Datacenters = "datacenters" + Attr_DatacenterStatus = "pi_datacenter_status" + Attr_DatacenterType = "pi_datacenter_type" + Attr_Dedicated = "dedicated" + Attr_Default = "default" + Attr_DeleteOnTermination = "delete_on_termination" + Attr_DeploymentType = "deployment_type" + Attr_Description = "description" + Attr_DestinationPort = "destination_port" + Attr_Details = "details" + Attr_DhcpID = "dhcp_id" + Attr_DhcpManaged = "dhcp_managed" + Attr_DisasterRecovery = "disaster_recovery" + Attr_DisasterRecoveryLocations = "disaster_recovery_locations" + Attr_DiskFormat = "disk_format" + Attr_DiskType = "disk_type" + Attr_DisplayName = "display_name" + Attr_DNS = "dns" + Attr_Enabled = "enabled" + Attr_Endianness = "endianness" + Attr_ExternalIP = "external_ip" + Attr_FailureMessage = "failure_message" + Attr_FailureReason = "failure_reason" + Attr_Fault = "fault" + Attr_Flag = "flag" + Attr_FlashCopyMappings = "flash_copy_mappings" + Attr_FlashCopyName = "flash_copy_name" + Attr_FreezeTime = "freeze_time" + Attr_FullSystemProfile = "full_system_profile" + Attr_Gateway = "gateway" + Attr_General = "general" + Attr_GlobalRouting = "global_routing" + Attr_GreDestinationAddress = "gre_destination_address" + Attr_GreSourceAddress = "gre_source_address" + Attr_GroupID = "group_id" + Attr_HealthStatus = "health_status" + Attr_HostGroup = "host_group" + Attr_HostGroupID = "host_group_id" + Attr_HostGroups = "host_groups" + Attr_HostID = "host_id" + Attr_Hosts = "hosts" + Attr_Href = "href" + Attr_Hypervisor = "hypervisor" + Attr_HypervisorType = "hypervisor_type" + Attr_IBMiCSS = "ibmi_css" + Attr_IBMIPAddress = "ibm_ip_address" + Attr_IBMiPHA = "ibmi_pha" + Attr_IBMiRDS = "ibmi_rds" + Attr_IBMiRDSUsers = "ibmi_rds_users" + Attr_ICMPType = "icmp_type" + Attr_ID = "id" + Attr_ImageID = "image_id" + Attr_ImageInfo = "image_info" + Attr_Images = "images" + Attr_ImageType = "image_type" + Attr_InputVolumes = "input_volumes" + Attr_Instance = "instance" + Attr_InstanceID = "instance_id" + Attr_InstanceIP = "instance_ip" + Attr_InstanceMac = "instance_mac" + Attr_Instances = "instances" + Attr_InstanceSnapshots = "instance_snapshots" + Attr_InstanceVolumes = "instance_volumes" + Attr_Interfaces = "interfaces" + Attr_IOThrottleRate = "io_throttle_rate" + Attr_IP = "ip" + Attr_IPAddress = "ip_address" + Attr_IPaddress = "ipaddress" + Attr_IPOctet = "ipoctet" + Attr_IsActive = "is_active" + Attr_Jumbo = "jumbo" + Attr_Key = "key" + 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_LicenseType = "license_type" + Attr_Location = "location" + Attr_MacAddress = "mac_address" + 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_Maximum = "maximum" + Attr_MaximumStorageAllocation = "max_storage_allocation" + Attr_MaxMem = "maxmem" + Attr_MaxMemory = "max_memory" + Attr_MaxMemoryAvailable = "max_memory_available" + Attr_MaxProc = "maxproc" + Attr_MaxProcessors = "max_processors" + Attr_MaxVirtualCores = "max_virtual_cores" + Attr_Members = "members" + Attr_Memory = "memory" + Attr_Message = "message" + Attr_Metered = "metered" + Attr_MigrationStatus = "migration_status" + Attr_Min = "min" + Attr_Minimum = "minimum" + Attr_MinMem = "minmem" + Attr_MinMemory = "min_memory" + Attr_MinProc = "minproc" + Attr_MinProcessors = "min_processors" + Attr_MinVirtualCores = "min_virtual_cores" + Attr_MirroringState = "mirroring_state" + Attr_MTU = "mtu" + Attr_Name = "name" + Attr_NetworkAddressGroupID = "network_address_group_id" + Attr_NetworkAddressGroups = "network_address_groups" + Attr_NetworkID = "network_id" + Attr_NetworkInterfaceID = "network_interface_id" + Attr_NetworkName = "network_name" + Attr_NetworkPortID = "network_port_id" + Attr_NetworkPorts = "network_ports" + Attr_Networks = "networks" + Attr_NetworkSecurityGroupID = "network_security_group_id" + Attr_NetworkSecurityGroupMemberID = "network_security_group_member_id" + Attr_NetworkSecurityGroups = "network_security_groups" + Attr_NumberOfVolumes = "number_of_volumes" + Attr_Onboardings = "onboardings" + Attr_OperatingSystem = "operating_system" + Attr_OSType = "os_type" + 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_PowerEdgeRouter = "power_edge_router" + Attr_Primary = "primary" + Attr_PrimaryRole = "primary_role" + Attr_Processors = "processors" + Attr_ProcType = "proctype" + Attr_Product = "product" + Attr_ProfileID = "profile_id" + Attr_Profiles = "profiles" + Attr_Progress = "progress" + Attr_Protocol = "protocol" + Attr_PublicIP = "public_ip" + Attr_PVMInstanceID = "pvm_instance_id" + Attr_PVMInstances = "pvm_instances" + Attr_PVMSnapshots = "pvm_snapshots" + Attr_Region = "region" + Attr_RegionStorageTiers = "region_storage_tiers" + Attr_Remote = "remote" + Attr_RemoteCopyID = "remote_copy_id" + Attr_RemoteCopyRelationshipNames = "remote_copy_relationship_names" + Attr_RemoteCopyRelationships = "remote_copy_relationships" + Attr_RemotePool = "remote_pool" + Attr_ReplicationEnabled = "replication_enabled" + Attr_ReplicationPoolMap = "replication_pool_map" + Attr_ReplicationSites = "replication_sites" + Attr_ReplicationStatus = "replication_status" + Attr_ReplicationType = "replication_type" + Attr_ReservedCore = "reserved_core" + Attr_ReservedCores = "reserved_cores" + Attr_ReservedMemory = "reserved_memory" + Attr_ResultsOnboardedVolumes = "results_onboarded_volumes" + Attr_ResultsVolumeOnboardingFailures = "results_volume_onboarding_failures" + Attr_Rules = "rules" + Attr_SAPS = "saps" + Attr_Secondaries = "secondaries" + Attr_ServerName = "server_name" + Attr_Servers = "servers" + 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_SharedProcessorPools = "shared_processor_pools" + Attr_Size = "size" + Attr_SnapshotID = "snapshot_id" + Attr_SourceChecksum = "source_checksum" + Attr_SourcePort = "source_port" + Attr_SourceVolumeID = "source_volume_id" + Attr_SourceVolumeName = "source_volume_name" + Attr_Speed = "speed" + Attr_SPPPlacementGroupID = "spp_placement_group_id" + Attr_SPPPlacementGroupMembers = "members" + Attr_SPPPlacementGroupName = "name" + Attr_SPPPlacementGroupPolicy = "policy" + Attr_SPPPlacementGroups = "spp_placement_groups" + Attr_SSHKey = "ssh_key" + Attr_StartTime = "start_time" + Attr_State = "state" + Attr_Status = "status" + Attr_StatusDescriptionErrors = "status_description_errors" + Attr_StatusDetail = "status_detail" + Attr_StorageConnection = "storage_connection" + Attr_StoragePool = "storage_pool" + Attr_StoragePoolAffinity = "storage_pool_affinity" + Attr_StoragePoolsCapacity = "storage_pools_capacity" + Attr_StorageType = "storage_type" + Attr_StorageTypesCapacity = "storage_types_capacity" + Attr_SupportedSystems = "supported_systems" + Attr_Synchronized = "synchronized" + Attr_SynchronousReplication = "synchronous_replication" + Attr_SystemPoolName = "system_pool_name" + Attr_SystemPools = "system_pools" + Attr_Systems = "systems" + Attr_SysType = "sys_type" + Attr_Systype = "systype" + Attr_Target = "target" + Attr_TargetLocations = "target_locations" + Attr_TargetVolumeName = "target_volume_name" + Attr_TaskID = "task_id" + Attr_TCPFlags = "tcp_flags" + Attr_TenantID = "tenant_id" + Attr_TenantName = "tenant_name" + Attr_TotalCapacity = "total_capacity" + Attr_TotalCore = "total_core" + Attr_TotalInstances = "total_instances" + Attr_TotalMemory = "total_memory" + 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_Uncapped = "uncapped" + Attr_UpdatedDate = "updated_date" + Attr_URL = "url" + Attr_UsedCore = "used_core" + Attr_UsedIPCount = "used_ip_count" + Attr_UsedIPPercent = "used_ip_percent" + Attr_UsedMemory = "used_memory" + Attr_UserIPAddress = "user_ip_address" + Attr_UserTags = "user_tags" + Attr_VCPUs = "vcpus" + Attr_Vendor = "vendor" + Attr_VirtualCoresAssigned = "virtual_cores_assigned" + Attr_VLanID = "vlan_id" + Attr_VolumeGroupID = "volume_group_id" + Attr_VolumeGroupName = "volume_group_name" + Attr_VolumeGroups = "volume_groups" + Attr_VolumeGroupStatus = "volume_group_status" + Attr_VolumeID = "volume_id" + Attr_VolumeIDs = "volume_ids" + Attr_VolumePool = "volume_pool" + Attr_Volumes = "volumes" + Attr_VolumeSnapshots = "volume_snapshots" + Attr_VolumesSnapshots = "volume_snapshots" + Attr_VolumeStatus = "volume_status" + Attr_VPCCRNs = "vpc_crns" + Attr_VPCEnabled = "vpc_enabled" + Attr_WorkloadType = "workload_type" + Attr_Workspace = "workspace" + Attr_WorkspaceCapabilities = "pi_workspace_capabilities" + Attr_WorkspaceDetails = "pi_workspace_details" + Attr_WorkspaceID = "pi_workspace_id" + Attr_WorkspaceLocation = "pi_workspace_location" + Attr_WorkspaceName = "pi_workspace_name" + Attr_Workspaces = "workspaces" + Attr_WorkspaceStatus = "pi_workspace_status" + Attr_WorkspaceType = "pi_workspace_type" + Attr_WWN = "wwn" // Duplicate Attributes, will be removed as refactoring take course. PICloudConnectionClassicGreSource = "gre_source_address" @@ -461,9 +438,6 @@ const ( PICloudConnectionId = "cloud_connection_id" PICloudConnectionPort = "port" PICloudConnectionUserIPAddress = "user_ip_address" - PIDRLocation = "location" - PIPlacementGroupID = "placement_group_id" - PIPlacementGroupMembers = "members" PIVPNConnectionDeadPeerDetectionAction = "action" // OS Type @@ -568,11 +542,6 @@ const ( State_Up = "up" State_Updating = "updating" State_VerifyResize = "verify_resize" - Status_Active = "ACTIVE" - Status_Deleting = "deleting" - Status_Error = "ERROR" - Status_Pending = "PENDING" - Status_Shutoff = "SHUTOFF" // Timeout values Timeout_Active = 2 * time.Minute @@ -581,18 +550,9 @@ const ( // TODO: Second Half Cleanup, remove extra variables - PIConsoleLanguageCode = "pi_language_code" - PIInstanceMigratable = "pi_migratable" - - // Volume Clone - PIVolumeCloneName = "pi_volume_clone_name" - PIVolumeCloneTaskID = "pi_volume_clone_task_id" - PITargetStorageTier = "pi_target_storage_tier" - // IBM PI Volume Group - PIVolumeGroupName = "pi_volume_group_name" - PIVolumeGroupConsistencyGroupName = "pi_consistency_group_name" - PIVolumeGroupAction = "pi_volume_group_action" + PIVolumeGroupAction = "pi_volume_group_action" + PIVolumeGroupID = "pi_volume_group_id" // VPN PIVPNConnectionId = "connection_id" @@ -605,10 +565,4 @@ const ( // Cloud Connections PICloudConnectionTransitEnabled = "pi_cloud_connection_transit_enabled" - - // IBM PI Workspace - PIWorkspaceName = "pi_name" - PIWorkspaceDatacenter = "pi_datacenter" - PIWorkspaceResourceGroup = "pi_resource_group_id" - PIWorkspacePlan = "pi_plan" ) diff --git a/ibm/service/power/resource_ibm_pi_cloud_connection_network_attach.go b/ibm/service/power/resource_ibm_pi_cloud_connection_network_attach.go index 24b472ed2c..0934dc4b12 100644 --- a/ibm/service/power/resource_ibm_pi_cloud_connection_network_attach.go +++ b/ibm/service/power/resource_ibm_pi_cloud_connection_network_attach.go @@ -9,17 +9,12 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - 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/IBM-Cloud/terraform-provider-ibm/ibm/flex" -) - -const ( - PICloudConnectionNetworkId = "pi_network_id" + "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 ResourceIBMPICloudConnectionNetworkAttach() *schema.Resource { @@ -35,24 +30,27 @@ func ResourceIBMPICloudConnectionNetworkAttach() *schema.Resource { }, Schema: map[string]*schema.Schema{ - // Required Attributes - helpers.PICloudInstanceId: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "PI cloud instance ID", + // Arguments + Arg_CloudConnectionID: { + Description: "Cloud Connection ID", + ForceNew: true, + Required: true, + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, }, - helpers.PICloudConnectionId: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "Cloud Connection ID", + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", + ForceNew: true, + Required: true, + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, }, - PICloudConnectionNetworkId: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "Network ID to attach to this cloud connection", + Arg_NetworkID: { + Description: "Network ID to attach to this cloud connection", + ForceNew: true, + Required: true, + Type: schema.TypeString, + ValidateFunc: validation.NoZeroValues, }, }, } @@ -64,12 +62,12 @@ func resourceIBMPICloudConnectionNetworkAttachCreate(ctx context.Context, d *sch return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - cloudConnectionID := d.Get(helpers.PICloudConnectionId).(string) - networkID := d.Get(PICloudConnectionNetworkId).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) + cloudConnectionID := d.Get(Arg_CloudConnectionID).(string) + networkID := d.Get(Arg_NetworkID).(string) - client := st.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) - jobClient := st.NewIBMPIJobClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) + jobClient := instance.NewIBMPIJobClient(ctx, sess, cloudInstanceID) _, jobReference, err := client.AddNetwork(cloudConnectionID, networkID) if err != nil { @@ -97,9 +95,9 @@ func resourceIBMPICloudConnectionNetworkAttachRead(ctx context.Context, d *schem cloudConnectionID := parts[1] networkID := parts[2] - d.Set(helpers.PICloudInstanceId, cloudInstanceID) - d.Set(helpers.PICloudConnectionId, cloudConnectionID) - d.Set(PICloudConnectionNetworkId, networkID) + d.Set(Arg_CloudInstanceID, cloudInstanceID) + d.Set(Arg_CloudConnectionID, cloudConnectionID) + d.Set(Arg_NetworkID, networkID) return nil } @@ -119,8 +117,8 @@ func resourceIBMPICloudConnectionNetworkAttachDelete(ctx context.Context, d *sch cloudConnectionID := parts[1] networkID := parts[2] - client := st.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) - jobClient := st.NewIBMPIJobClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPICloudConnectionClient(ctx, sess, cloudInstanceID) + jobClient := instance.NewIBMPIJobClient(ctx, sess, cloudInstanceID) _, jobReference, err := client.DeleteNetwork(cloudConnectionID, networkID) if err != nil { @@ -128,7 +126,7 @@ func resourceIBMPICloudConnectionNetworkAttachDelete(ctx context.Context, d *sch return diag.FromErr(err) } if jobReference != nil { - _, err = waitForIBMPIJobCompleted(ctx, jobClient, *jobReference.ID, d.Timeout(schema.TimeoutUpdate)) + _, err = waitForIBMPIJobCompleted(ctx, jobClient, *jobReference.ID, d.Timeout(schema.TimeoutDelete)) if err != nil { return diag.FromErr(err) } diff --git a/ibm/service/power/resource_ibm_pi_shared_processor_pool.go b/ibm/service/power/resource_ibm_pi_shared_processor_pool.go index a636931b90..ccd4b9371c 100644 --- a/ibm/service/power/resource_ibm_pi_shared_processor_pool.go +++ b/ibm/service/power/resource_ibm_pi_shared_processor_pool.go @@ -10,13 +10,13 @@ import ( "strings" "time" - st "github.com/IBM-Cloud/power-go-client/clients/instance" - "github.com/IBM-Cloud/power-go-client/helpers" - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -35,42 +35,47 @@ func ResourceIBMPISharedProcessorPool() *schema.Resource { }, Schema: map[string]*schema.Schema{ - - // Required Arguments - Arg_SharedProcessorPoolName: { - Type: schema.TypeString, + // Arguments + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", + ForceNew: true, Required: true, - Description: "Name of the shared processor pool", + Type: schema.TypeString, }, - - Arg_SharedProcessorPoolHostGroup: { + Arg_HostID: { + Description: "The host id of a host in a host group (only available for dedicated hosts).", + Optional: true, Type: schema.TypeString, - Required: true, - Description: "Host group of the shared processor pool", }, - - Arg_SharedProcessorPoolReservedCores: { - Type: schema.TypeInt, + Arg_SharedProcessorPoolHostGroup: { + Description: "Host group of the shared processor pool. Valid values are 's922', 'e980' and 's1022'.", + ForceNew: true, Required: true, - Description: "The amount of reserved cores for the shared processor pool", - }, - - Arg_CloudInstanceID: { Type: schema.TypeString, - Required: true, - Description: "PI cloud instance ID", }, - Arg_HostID: { - Description: "The host id of a host in a host group (only available for dedicated hosts)", - Optional: true, + Arg_SharedProcessorPoolName: { + Description: "The name of the shared processor pool.", + Required: true, Type: schema.TypeString, }, - - // Optional Arguments Arg_SharedProcessorPoolPlacementGroupID: { - Type: schema.TypeString, - Optional: true, - Description: "Placement group the shared processor pool is created in", + ConflictsWith: []string{Arg_SharedProcessorPoolPlacementGroups}, + Deprecated: "This field is deprecated, use pi_shared_processor_pool_placement_groups instead", + Description: "The ID of the placement group the shared processor pool is created in.", + Optional: true, + Type: schema.TypeString, + }, + Arg_SharedProcessorPoolPlacementGroups: { + ConflictsWith: []string{Arg_SharedProcessorPoolPlacementGroupID, Attr_SharedProcessorPoolPlacementGroups}, + Description: "The list of shared processor pool placement groups that the shared processor pool is in.", + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Type: schema.TypeList, + }, + Arg_SharedProcessorPoolReservedCores: { + Description: "The amount of reserved cores for the shared processor pool.", + Required: true, + Type: schema.TypeInt, }, Arg_UserTags: { Description: "The user tags attached to this resource.", @@ -81,102 +86,97 @@ func ResourceIBMPISharedProcessorPool() *schema.Resource { }, // Attributes - Attr_CRN: { + Attr_AllocatedCores: { Computed: true, - Description: "The CRN of this resource.", - Type: schema.TypeString, + Description: "The allocated cores in the shared processor pool.", + Type: schema.TypeFloat, }, - Attr_SharedProcessorPoolID: { - Type: schema.TypeString, + Attr_AvailableCores: { Computed: true, - Description: "Shared processor pool ID", - }, - - Attr_SharedProcessorPoolAvailableCores: { + Description: "The available cores in the shared processor pool.", Type: schema.TypeInt, - Computed: true, - Description: "Shared processor pool available cores", - }, - - Attr_SharedProcessorPoolAllocatedCores: { - Type: schema.TypeFloat, - Computed: true, - Description: "Shared processor pool allocated cores", }, - - Attr_SharedProcessorPoolHostID: { - Type: schema.TypeInt, + Attr_CRN: { Computed: true, - Description: "The host ID where the shared processor pool resides", - }, - - Attr_Status: { + Description: "The CRN of this resource.", Type: schema.TypeString, - Computed: true, - Description: "The status of the shared processor pool", }, - - Attr_StatusDetail: { - Type: schema.TypeString, + Attr_HostID: { Computed: true, - Description: "The status details of the shared processor pool", - }, - - Attr_SharedProcessorPoolPlacementGroups: { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Description: "SPP placement groups the shared processor pool are in", + Description: "The host ID where the shared processor pool resides.", + Type: schema.TypeInt, }, - - Attr_SharedProcessorPoolInstances: { - Type: schema.TypeList, + Attr_Instances: { Computed: true, - Description: "List of server instances deployed in the shared processor pool", + Description: "The list of server instances that are deployed in the shared processor pool.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - Attr_SharedProcessorPoolInstanceCpus: { - Type: schema.TypeInt, + Attr_AvailabilityZone: { Computed: true, - Description: "The amount of cpus for the server instance", + Description: "Availability zone for the server instances.", + Type: schema.TypeString, }, - Attr_SharedProcessorPoolInstanceUncapped: { - Type: schema.TypeBool, + Attr_CPUs: { Computed: true, - Description: "Identifies if uncapped or not", + Description: "The amount of cpus for the server instance.", + Type: schema.TypeInt, }, - Attr_SharedProcessorPoolInstanceAvailabilityZone: { - Type: schema.TypeString, + Attr_ID: { Computed: true, - Description: "Availability zone for the server instances", - }, - Attr_SharedProcessorPoolInstanceId: { + Description: "The server instance ID.", Type: schema.TypeString, - Computed: true, - Description: "The server instance ID", }, - Attr_SharedProcessorPoolInstanceMemory: { - Type: schema.TypeInt, + Attr_Memory: { Computed: true, - Description: "The amount of memory for the server instance", + Description: "The amount of memory for the server instance.", + Type: schema.TypeInt, }, - Attr_SharedProcessorPoolInstanceName: { - Type: schema.TypeString, + Attr_Name: { Computed: true, - Description: "The server instance name", + Description: "The server instance name.", + Type: schema.TypeString, }, Attr_Status: { + Computed: true, + Description: "Status of the instance.", Type: schema.TypeString, + }, + Attr_Uncapped: { Computed: true, - Description: "Status of the server", + Description: "Identifies if uncapped or not.", + Type: schema.TypeBool, }, - Attr_SharedProcessorPoolInstanceVcpus: { - Type: schema.TypeFloat, + Attr_VCPUs: { Computed: true, - Description: "The amout of vcpus for the server instance", + Description: "The amout of vcpus for the server instance.", + Type: schema.TypeFloat, }, }, }, + Type: schema.TypeList, + }, + Attr_SharedProcessorPoolID: { + Computed: true, + Description: "The shared processor pool's unique ID.", + Type: schema.TypeString, + }, + Attr_SharedProcessorPoolPlacementGroups: { + ConflictsWith: []string{Arg_SharedProcessorPoolPlacementGroups}, + Deprecated: "This field is deprecated, use pi_shared_processor_pool_placement_groups instead", + Description: "The list of shared processor pool placement groups that the shared processor pool is in.", + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Type: schema.TypeList, + }, + Attr_Status: { + Computed: true, + Description: "The status of the shared processor pool.", + Type: schema.TypeString, + }, + Attr_StatusDetail: { + Computed: true, + Description: "The status details of the shared processor pool.", + Type: schema.TypeString, }, }, } @@ -188,13 +188,13 @@ func resourceIBMPISharedProcessorPoolCreate(ctx context.Context, d *schema.Resou return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - name := d.Get(Arg_SharedProcessorPoolName).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) hostGroup := d.Get(Arg_SharedProcessorPoolHostGroup).(string) hostID := d.Get(Arg_HostID).(string) + name := d.Get(Arg_SharedProcessorPoolName).(string) reservedCores := d.Get(Arg_SharedProcessorPoolReservedCores).(int) cores := int64(reservedCores) - client := st.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) body := &models.SharedProcessorPoolCreate{ HostGroup: &hostGroup, HostID: hostID, @@ -214,13 +214,17 @@ func resourceIBMPISharedProcessorPoolCreate(ctx context.Context, d *schema.Resou return diag.Errorf("error creating the shared processor pool: %v", err) } - var sharedProcessorPoolReadyStatus string d.SetId(fmt.Sprintf("%s/%s", cloudInstanceID, *spp.ID)) - _, err = isWaitForPISharedProcessorPoolAvailable(ctx, d, client, *spp.ID, sharedProcessorPoolReadyStatus) + _, err = isWaitForPISharedProcessorPoolAvailable(ctx, d, client, *spp.ID) if err != nil { return diag.FromErr(err) } + diagErr := detectSPPPlacementGroupChange(ctx, sess, cloudInstanceID, d, *spp.ID) + if diagErr != nil { + return diagErr + } + if _, ok := d.GetOk(Arg_UserTags); ok { if spp.Crn != "" { oldList, newList := d.GetChange(Arg_UserTags) @@ -232,16 +236,15 @@ func resourceIBMPISharedProcessorPoolCreate(ctx context.Context, d *schema.Resou } return resourceIBMPISharedProcessorPoolRead(ctx, d, meta) - } -func isWaitForPISharedProcessorPoolAvailable(ctx context.Context, d *schema.ResourceData, client *st.IBMPISharedProcessorPoolClient, id string, sharedProcessorPoolReadyStatus string) (interface{}, error) { +func isWaitForPISharedProcessorPoolAvailable(ctx context.Context, d *schema.ResourceData, client *instance.IBMPISharedProcessorPoolClient, id string) (interface{}, error) { log.Printf("Waiting for PISharedProcessorPool (%s) to be active ", id) - stateConf := &resource.StateChangeConf{ - Pending: []string{"configuring"}, - Target: []string{"active", "failed", ""}, - Refresh: isPISharedProcessorPoolRefreshFunc(client, id, sharedProcessorPoolReadyStatus), + stateConf := &retry.StateChangeConf{ + Pending: []string{State_Configuring}, + Target: []string{State_Active, State_Failed, ""}, + Refresh: isPISharedProcessorPoolRefreshFunc(client, id), Delay: 20 * time.Second, MinTimeout: Timeout_Active, Timeout: d.Timeout(schema.TimeoutCreate), @@ -250,23 +253,20 @@ func isWaitForPISharedProcessorPoolAvailable(ctx context.Context, d *schema.Reso return stateConf.WaitForStateContext(ctx) } -func isPISharedProcessorPoolRefreshFunc(client *st.IBMPISharedProcessorPoolClient, id, sharedProcessorPoolReadyStatus string) resource.StateRefreshFunc { +func isPISharedProcessorPoolRefreshFunc(client *instance.IBMPISharedProcessorPoolClient, id string) retry.StateRefreshFunc { return func() (interface{}, string, error) { - pool, err := client.Get(id) if err != nil { return nil, "", err } - // Check for `sharedProcessorPoolReadyStatus` status - if pool.SharedProcessorPool.Status == "active" { - return pool, "active", nil + if pool.SharedProcessorPool.Status == State_Active { + return pool, State_Active, nil } - if pool.SharedProcessorPool.Status == "failed" { + if pool.SharedProcessorPool.Status == State_Failed { err = fmt.Errorf("failed to create the shared processor pool") return pool, pool.SharedProcessorPool.Status, err } - - return pool, "configuring", nil + return pool, State_Configuring, nil } } @@ -282,7 +282,7 @@ func resourceIBMPISharedProcessorPoolRead(ctx context.Context, d *schema.Resourc } cloudInstanceID := parts[0] - client := st.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) response, err := client.Get(parts[1]) if err != nil || response == nil { @@ -306,48 +306,49 @@ func resourceIBMPISharedProcessorPoolRead(ctx context.Context, d *schema.Resourc if response.SharedProcessorPool.ID != nil { d.Set(Attr_SharedProcessorPoolID, response.SharedProcessorPool.ID) } - if response.SharedProcessorPool.ReservedCores != nil { - d.Set(Arg_SharedProcessorPoolReservedCores, response.SharedProcessorPool.ReservedCores) - } if response.SharedProcessorPool.AllocatedCores != nil { - d.Set(Attr_SharedProcessorPoolAllocatedCores, response.SharedProcessorPool.AllocatedCores) + d.Set(Attr_AllocatedCores, response.SharedProcessorPool.AllocatedCores) } if response.SharedProcessorPool.AvailableCores != nil { - d.Set(Attr_SharedProcessorPoolAvailableCores, response.SharedProcessorPool.AvailableCores) + d.Set(Attr_AvailableCores, response.SharedProcessorPool.AvailableCores) } - if response.SharedProcessorPool.AvailableCores != nil { - d.Set(Attr_SharedProcessorPoolAvailableCores, response.SharedProcessorPool.AvailableCores) + if response.SharedProcessorPool.ReservedCores != nil { + d.Set(Arg_SharedProcessorPoolReservedCores, response.SharedProcessorPool.ReservedCores) } if response.SharedProcessorPool.SharedProcessorPoolPlacementGroups != nil { pgIDs := make([]string, len(response.SharedProcessorPool.SharedProcessorPoolPlacementGroups)) for i, pg := range response.SharedProcessorPool.SharedProcessorPoolPlacementGroups { pgIDs[i] = *pg.ID } - d.Set(Attr_SharedProcessorPoolPlacementGroups, pgIDs) + if _, ok := d.GetOk(Attr_SharedProcessorPoolPlacementGroups); ok { + d.Set(Attr_SharedProcessorPoolPlacementGroups, pgIDs) + } else { + d.Set(Arg_SharedProcessorPoolPlacementGroups, pgIDs) + } } - d.Set(Attr_SharedProcessorPoolHostID, response.SharedProcessorPool.HostID) + d.Set(Attr_HostID, response.SharedProcessorPool.HostID) d.Set(Attr_Status, response.SharedProcessorPool.Status) - d.Set(Attr_SharedProcessorPoolStatusDetail, response.SharedProcessorPool.StatusDetail) + d.Set(Attr_StatusDetail, response.SharedProcessorPool.StatusDetail) serversMap := []map[string]interface{}{} if response.Servers != nil { for _, s := range response.Servers { if s != nil { v := map[string]interface{}{ - Attr_SharedProcessorPoolInstanceCpus: s.Cpus, - Attr_SharedProcessorPoolInstanceUncapped: s.Uncapped, - Attr_SharedProcessorPoolInstanceAvailabilityZone: s.AvailabilityZone, - Attr_SharedProcessorPoolInstanceId: s.ID, - Attr_SharedProcessorPoolInstanceMemory: s.Memory, - Attr_SharedProcessorPoolInstanceName: s.Name, - Attr_Status: s.Status, - Attr_SharedProcessorPoolInstanceVcpus: s.Vcpus, + Attr_AvailabilityZone: s.AvailabilityZone, + Attr_CPUs: s.Cpus, + Attr_ID: s.ID, + Attr_Memory: s.Memory, + Attr_Name: s.Name, + Attr_Status: s.Status, + Attr_Uncapped: s.Uncapped, + Attr_VCPUs: s.Vcpus, } serversMap = append(serversMap, v) } } } - d.Set(Attr_SharedProcessorPoolInstances, serversMap) + d.Set(Attr_Instances, serversMap) return nil } @@ -363,7 +364,7 @@ func resourceIBMPISharedProcessorPoolUpdate(ctx context.Context, d *schema.Resou return diag.FromErr(err) } - client := st.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) body := &models.SharedProcessorPoolUpdate{} if d.HasChange(Arg_SharedProcessorPoolName) { @@ -380,11 +381,35 @@ func resourceIBMPISharedProcessorPoolUpdate(ctx context.Context, d *schema.Resou return diag.Errorf("error updating the shared processor pool: %v", err) } - if d.HasChange(Attr_SharedProcessorPoolPlacementGroups) { + diagErr := detectSPPPlacementGroupChange(ctx, sess, cloudInstanceID, d, sppID) + if diagErr != nil { + return diagErr + } - pgClient := st.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) + if d.HasChange(Arg_UserTags) { + if crn, ok := d.GetOk(Attr_CRN); ok { + oldList, newList := d.GetChange(Arg_UserTags) + err := flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, crn.(string), "", UserTagType) + if err != nil { + log.Printf("Error on update of pi shared processor pool (%s) pi_user_tags: %s", sppID, err) + } + } + } + + return resourceIBMPISharedProcessorPoolRead(ctx, d, meta) +} - oldRaw, newRaw := d.GetChange(Attr_SharedProcessorPoolPlacementGroups) +func detectSPPPlacementGroupChange(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string, d *schema.ResourceData, sppID string) diag.Diagnostics { + if d.HasChanges(Arg_SharedProcessorPoolPlacementGroups, Attr_SharedProcessorPoolPlacementGroups) { + + pgClient := instance.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) + + var oldRaw, newRaw interface{} + if d.HasChange(Arg_SharedProcessorPoolPlacementGroups) { + oldRaw, newRaw = d.GetChange(Arg_SharedProcessorPoolPlacementGroups) + } else { + oldRaw, newRaw = d.GetChange(Attr_SharedProcessorPoolPlacementGroups) + } old := oldRaw.([]interface{}) new := newRaw.([]interface{}) @@ -427,18 +452,7 @@ func resourceIBMPISharedProcessorPoolUpdate(ctx context.Context, d *schema.Resou } } } - - if d.HasChange(Arg_UserTags) { - if crn, ok := d.GetOk(Attr_CRN); ok { - oldList, newList := d.GetChange(Arg_UserTags) - err := flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, crn.(string), "", UserTagType) - if err != nil { - log.Printf("Error on update of pi shared processor pool (%s) pi_user_tags: %s", sppID, err) - } - } - } - - return resourceIBMPISharedProcessorPoolRead(ctx, d, meta) + return nil } // returns the elements in string array a that are not in array z @@ -466,7 +480,7 @@ func resourceIBMPISharedProcessorPoolDelete(ctx context.Context, d *schema.Resou return diag.FromErr(err) } cloudInstanceID := parts[0] - client := st.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISharedProcessorPoolClient(ctx, sess, cloudInstanceID) err = client.Delete(parts[1]) if err != nil { diff --git a/ibm/service/power/resource_ibm_pi_shared_processor_pool_test.go b/ibm/service/power/resource_ibm_pi_shared_processor_pool_test.go index 1e7e572b63..4b9d19dbb1 100644 --- a/ibm/service/power/resource_ibm_pi_shared_processor_pool_test.go +++ b/ibm/service/power/resource_ibm_pi_shared_processor_pool_test.go @@ -129,9 +129,9 @@ func testAccCheckIBMPISPPExists(n string) resource.TestCheckFunc { func testAccCheckIBMPISPPConfig(name string) string { return fmt.Sprintf(` resource "ibm_pi_shared_processor_pool" "power_shared_processor_pool" { - pi_cloud_instance_id = "%[2]s" - pi_shared_processor_pool_host_group = "s922" - pi_shared_processor_pool_name = "%[1]s" + pi_cloud_instance_id = "%[2]s" + pi_shared_processor_pool_host_group = "s922" + pi_shared_processor_pool_name = "%[1]s" pi_shared_processor_pool_reserved_cores = "1" }`, name, acc.Pi_cloud_instance_id) } @@ -139,11 +139,10 @@ func testAccCheckIBMPISPPConfig(name string) string { func testAccCheckIBMPISPPUserTagsConfig(name string, userTagsString string) string { return fmt.Sprintf(` resource "ibm_pi_shared_processor_pool" "power_shared_processor_pool" { - pi_cloud_instance_id = "%[2]s" - pi_shared_processor_pool_host_group = "s922" - pi_shared_processor_pool_name = "%[1]s" + pi_cloud_instance_id = "%[2]s" + pi_shared_processor_pool_host_group = "s922" + pi_shared_processor_pool_name = "%[1]s" pi_shared_processor_pool_reserved_cores = "1" - pi_user_tags = %[3]s - + pi_user_tags = %[3]s }`, name, acc.Pi_cloud_instance_id, userTagsString) } diff --git a/website/docs/d/is_bare_metal_server_network_interface_floating_ip.markdown b/website/docs/d/is_bare_metal_server_network_interface_floating_ip.markdown index 3ebf3f5077..a640d64ccc 100644 --- a/website/docs/d/is_bare_metal_server_network_interface_floating_ip.markdown +++ b/website/docs/d/is_bare_metal_server_network_interface_floating_ip.markdown @@ -24,7 +24,7 @@ provider "ibm" { ```terraform - data "is_bare_metal_server_network_interface_floating_ip" "test" { + data "ibm_is_bare_metal_server_network_interface_floating_ip" "test" { bare_metal_server = ibm_is_bare_metal_server.example.id floating_ip = ibm_is_floating_ip.example.id network_interface = ibm_is_bare_metal_server_network_interface.example.id diff --git a/website/docs/d/is_bare_metal_server_network_interface_floating_ips.markdown b/website/docs/d/is_bare_metal_server_network_interface_floating_ips.markdown index dfc69fe6d7..8c459150ac 100644 --- a/website/docs/d/is_bare_metal_server_network_interface_floating_ips.markdown +++ b/website/docs/d/is_bare_metal_server_network_interface_floating_ips.markdown @@ -24,7 +24,7 @@ provider "ibm" { ```terraform - data "is_bare_metal_server_network_interface_floating_ips" "test" { + data "ibm_is_bare_metal_server_network_interface_floating_ips" "test" { bare_metal_server = "xxxx-xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx" network_interface = "xxxx-xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx" } diff --git a/website/docs/d/is_instance_disk.html.markdown b/website/docs/d/is_instance_disk.html.markdown index 6128307a04..e0e0623212 100644 --- a/website/docs/d/is_instance_disk.html.markdown +++ b/website/docs/d/is_instance_disk.html.markdown @@ -73,7 +73,7 @@ data "ibm_is_instance" "example" { passphrase = "" } -data "is_instance_disk" "example" { +data "ibm_is_instance_disk" "example" { instance = data.ibm_is_instance.example.id disk = data.ibm_is_instance.example.disks.0.id } diff --git a/website/docs/d/is_instance_disks.html.markdown b/website/docs/d/is_instance_disks.html.markdown index e33036b748..70fb72a1a5 100644 --- a/website/docs/d/is_instance_disks.html.markdown +++ b/website/docs/d/is_instance_disks.html.markdown @@ -72,7 +72,7 @@ data "ibm_is_instance" "example" { passphrase = "" } -data "is_instance_disks" "example" { +data "ibm_is_instance_disks" "example" { instance = data.ibm_is_instance.example.id } ``` diff --git a/website/docs/d/is_placement_group.html.markdown b/website/docs/d/is_placement_group.html.markdown index 39c9b164b0..87e485c27b 100644 --- a/website/docs/d/is_placement_group.html.markdown +++ b/website/docs/d/is_placement_group.html.markdown @@ -23,7 +23,7 @@ provider "ibm" { ## Example usage ```terraform -data "is_placement_group" "example" { +data "ibm_is_placement_group" "example" { name = ibm_is_placement_group.example.name } ``` diff --git a/website/docs/d/is_placement_groups.html.markdown b/website/docs/d/is_placement_groups.html.markdown index c53561d56d..bd02dad3bf 100644 --- a/website/docs/d/is_placement_groups.html.markdown +++ b/website/docs/d/is_placement_groups.html.markdown @@ -24,7 +24,7 @@ provider "ibm" { ## Example usage ```terraform -data "is_placement_groups" "example" { +data "ibm_is_placement_groups" "example" { } ``` diff --git a/website/docs/r/is_instance_disk_management.html.markdown b/website/docs/r/is_instance_disk_management.html.markdown index 8995116656..978ab1aa6e 100644 --- a/website/docs/r/is_instance_disk_management.html.markdown +++ b/website/docs/r/is_instance_disk_management.html.markdown @@ -63,7 +63,7 @@ data "ibm_is_instance" "example" { passphrase = "" } -data "is_instance_disk" "example" { +data "ibm_is_instance_disk" "example" { instance = data.ibm_is_instance.example.id disk = data.ibm_is_instance.example.disks.0.id } diff --git a/website/docs/r/pi_cloud_connection_network_attach.html.markdown b/website/docs/r/pi_cloud_connection_network_attach.html.markdown index d562c7770d..129c95be9c 100644 --- a/website/docs/r/pi_cloud_connection_network_attach.html.markdown +++ b/website/docs/r/pi_cloud_connection_network_attach.html.markdown @@ -1,5 +1,4 @@ --- - subcategory: "Power Systems" layout: "ibm" page_title: "IBM: pi_cloud_connection_network_attach" @@ -9,7 +8,7 @@ description: |- # ibm_pi_cloud_connection_network_attach -Attach, detach Network to a Cloud Connection for a Power Systems Virtual Server. 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). +Attach, and detach a network to a cloud connection for a Power Systems Virtual Server. 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 @@ -17,20 +16,20 @@ The following example enables you attach a network to a cloud connection: ```terraform resource "ibm_pi_cloud_connection_network_attach" "example" { - pi_cloud_instance_id = "" pi_cloud_connection_id = "" - pi_network_id = "" + pi_cloud_instance_id = "" + pi_network_id = "" } ``` -**Note** +### 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` +- 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" { @@ -43,30 +42,29 @@ resource "ibm_pi_cloud_connection_network_attach" "example" { The `ibm_pi_cloud_connection_network_attach` provides the following [timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: -- **Create** The attach of network to the cloud connection is considered failed if no response is received for 30 minutes. -- **Delete** The detach of network from the cloud connection is considered failed if no response is received for 30 minutes. +- **create** - (Default 30 minutes) Used for attaching a network from a cloud connection. +- **delete** - (Default 30 minutes) Used for detaching a network from a cloud connection. ## Argument reference -Review the argument references that you can specify for your resource. +Review the argument references that you can specify for your resource. -- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. - `pi_cloud_connection_id` - (Required, String) The Cloud Connection ID. +- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. - `pi_network_id` - (Required, String) The Network ID to attach to this cloud connection. - ## Attribute reference In addition to all argument reference list, you can access the following attribute reference after your resource is created. -- `id` - (String) The unique identifier of cloud connection network attachment. +- `id` - (String) The unique identifier of cloud connection network attachment. The ID is composed of `//`. ## Import The `ibm_pi_cloud_connection_network_attach` can be imported by using `pi_cloud_instance_id`, `pi_cloud_connection_id` and `pi_network_id`. -**Example** +### Example ```sh -$ terraform import ibm_pi_cloud_connection_network_attach.example d7bec597-4726-451f-8a63-e62e6f19c32c/cea6651a-bc0a-4438-9f8a-a0770bbf3ebb/4726d7be-c597-4438-9f8a-cea6651abc0a +terraform import ibm_pi_cloud_connection_network_attach.example d7bec597-4726-451f-8a63-e62e6f19c32c/cea6651a-bc0a-4438-9f8a-a0770bbf3ebb/4726d7be-c597-4438-9f8a-cea6651abc0a ``` diff --git a/website/docs/r/pi_shared_processor_pool.html.markdown b/website/docs/r/pi_shared_processor_pool.html.markdown index be21015050..24250d17a7 100644 --- a/website/docs/r/pi_shared_processor_pool.html.markdown +++ b/website/docs/r/pi_shared_processor_pool.html.markdown @@ -1,5 +1,4 @@ --- - subcategory: "Power Systems" layout: "ibm" page_title: "IBM: pi_shared_processor_pool" @@ -17,21 +16,21 @@ The following example enables you to create a shared processor pool with a group ```terraform resource "ibm_pi_shared_processor_pool" "testacc_shared_processor_pool" { - pi_shared_processor_pool_name = "my_spp" - pi_shared_processor_pool_host_group = "s922" + pi_cloud_instance_id = "" + pi_shared_processor_pool_host_group = "s922" + pi_shared_processor_pool_name = "my_spp" pi_shared_processor_pool_reserved_cores = "2" - pi_cloud_instance_id = "" } ``` ### 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` +- 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" { @@ -44,48 +43,49 @@ resource "ibm_pi_shared_processor_pool" "testacc_shared_processor_pool" { ibm_pi_shared_processor_pool provides the following [timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: -* **create** - (Default 60 minutes) Used for creating a shared processor pool placement group. -* **delete** - (Default 60 minutes) Used for deleting a shared processor pool placement group. -* **update** - (Default 60 minutes) Used for updating a shared processor pool placement group. +- **create** - (Default 60 minutes) Used for creating a shared processor pool. +- **delete** - (Default 60 minutes) Used for deleting a shared processor pool. +- **update** - (Default 60 minutes) Used for updating a shared processor pool. ## Argument reference Review the argument references that you can specify for your resource. -* `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. -* `pi_host_id` - (Optional, String) The host id of a host in a host group (only available for dedicated hosts). -* `pi_shared_processor_pool_host_group` - (Required, String) Host group of the shared processor pool. Valid values are 's922', 'e980' and 's1022'. -* `pi_shared_processor_pool_name` - (Required, String) The name of the shared processor pool. -* `pi_shared_processor_pool_reserved_cores` - (Required, Integer) The amount of reserved cores for the shared processor pool. -* `pi_shared_processor_pool_placement_group_id` - (Optional, String) The ID of the placement group the shared processor pool is created in. -* `pi_user_tags` - (Optional, List) The user tags attached to this resource. +- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. +- `pi_host_id` - (Optional, String) The host id of a host in a host group (only available for dedicated hosts). +- `pi_shared_processor_pool_host_group` - (Required, String) Host group of the shared processor pool. Valid values are 's922', 'e980' and 's1022'. +- `pi_shared_processor_pool_name` - (Required, String) The name of the shared processor pool. +- `pi_shared_processor_pool_placement_group_id` - (Deprecated, Optional, String) The ID of the placement group the shared processor pool is created in. Please use pi_shared_processor_pool_placement_groups instead. +- `pi_shared_processor_pool_placement_groups` - (Optional, List) The list of shared processor pool placement groups that the shared processor pool is in. +- `pi_shared_processor_pool_reserved_cores` - (Required, Integer) The amount of reserved cores for the shared processor pool. +- `pi_user_tags` - (Optional, List) The user tags attached to this resource. ## Attribute reference - In addition to all argument reference list, you can access the following attribute reference after your resource is created. +In addition to all argument reference list, you can access the following attribute reference after your resource is created. -* `allocated_cores` - (Float) The allocated cores in the shared processor pool. -* `available_cores` - (Integer) The available cores in the shared processor pool. -* `crn` - (String) The CRN of this resource. -* `host_id` - (Integer) The host ID where the shared processor pool resides. -* `instances` - (List of Map) The list of server instances that are deployed in the shared processor pool. +- `allocated_cores` - (Float) The allocated cores in the shared processor pool. +- `available_cores` - (Integer) The available cores in the shared processor pool. +- `crn` - (String) The CRN of this resource. +- `host_id` - (Integer) The host ID where the shared processor pool resides. +- `instances` - (List of Map) The list of server instances that are deployed in the shared processor pool. Nested scheme for `instances`: - * `availability_zone` - (String) Availability zone for the server instances. - * `cpus` - (Integer) The amount of cpus for the server instance. - * `id` - (String) The server instance ID. - * `memory` - (Integer) The amount of memory for the server instance. - * `name` - (String) The server instance name. - * `status` - (String) Status of the instance. - * `uncapped` - (Bool) Identifies if uncapped or not. - * `vcpus` - (Float) The amout of vcpus for the server instance. -* `shared_processor_pool_id` - (String) The shared processor pool's unique ID. -* `status` - (String) The status of the shared processor pool. -* `status_detail` - (String) The status details of the shared processor pool. + - `availability_zone` - (String) Availability zone for the server instances. + - `cpus` - (Integer) The amount of cpus for the server instance. + - `id` - (String) The server instance ID. + - `memory` - (Integer) The amount of memory for the server instance. + - `name` - (String) The server instance name. + - `status` - (String) Status of the instance. + - `uncapped` - (Bool) Identifies if uncapped or not. + - `vcpus` - (Float) The amout of vcpus for the server instance. +- `shared_processor_pool_id` - (String) The shared processor pool's unique ID. +- `status` - (String) The status of the shared processor pool. +- `status_detail` - (String) The status details of the shared processor pool. ## Import -The `ibm_pi_shared_processor_pool` resource can be imported by using `power_instance_id` and `shared_processor_pool_id`. +The `ibm_pi_shared_processor_pool` resource can be imported by using `pi_cloud_instance_id` and `shared_processor_pool_id`. ### Example