Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
538c424
SDK Usage Constraint
SunithaGudisagarIBM1 Sep 9, 2024
ca1111a
maturity updated
SunithaGudisagarIBM1 Sep 9, 2024
c0315d4
SDK updated
SunithaGudisagarIBM1 Sep 10, 2024
b1c31b6
Image resource update
SunithaGudisagarIBM1 Sep 10, 2024
7c88bd5
Volume resource development
SunithaGudisagarIBM1 Sep 10, 2024
d38c769
Snapshot resource development
SunithaGudisagarIBM1 Sep 10, 2024
eab9742
Volume create and patch
SunithaGudisagarIBM1 Sep 14, 2024
e96f04d
Instance Update
SunithaGudisagarIBM1 Sep 15, 2024
ccb5020
Documents
SunithaGudisagarIBM1 Sep 15, 2024
a8b693c
Removed comment
SunithaGudisagarIBM1 Sep 16, 2024
d022e4e
sdk changes for image capabilities
SunithaGudisagarIBM1 Nov 3, 2024
865d479
go mod update
SunithaGudisagarIBM1 Nov 3, 2024
8b064ba
Merge branch 'master' into image-usage-constraint
SunithaGudisagarIBM1 Nov 3, 2024
9e58636
sdk updated, error fixed
SunithaGudisagarIBM1 Nov 3, 2024
78b9236
Datasource and Resource Update
SunithaGudisagarIBM1 Nov 4, 2024
ebfa459
bare metal server profiles development
SunithaGudisagarIBM1 Nov 4, 2024
eb7ce65
image instance profiles update
SunithaGudisagarIBM1 Nov 4, 2024
7b98cfc
Doc correction
SunithaGudisagarIBM1 Nov 4, 2024
255aedb
doc resource changes
SunithaGudisagarIBM1 Nov 4, 2024
2caf5c9
Call update in create operatons
SunithaGudisagarIBM1 Nov 6, 2024
da4f60a
Merge branch 'master' into image-usage-constraint
SunithaGudisagarIBM1 Dec 1, 2024
c912909
SDK updated
SunithaGudisagarIBM1 Dec 1, 2024
2a6e883
Snapshot and Volume Instance Profiles Development
SunithaGudisagarIBM1 Dec 1, 2024
0a960a0
Added acceptance test and maturity
SunithaGudisagarIBM1 Dec 2, 2024
fd1d796
Volume and Snapshot correction
SunithaGudisagarIBM1 Dec 2, 2024
51e0d3e
Updated etag to Snapshot and Imple Acct test for Image
SunithaGudisagarIBM1 Dec 2, 2024
0b79b8e
Merge branch 'master' into image-usage-constraint
SunithaGudisagarIBM1 Jan 15, 2025
3188b7c
Updated SDK
SunithaGudisagarIBM1 Jan 15, 2025
530b14a
New changes as per the spec
SunithaGudisagarIBM1 Jan 15, 2025
a3dcc2b
Doc update
SunithaGudisagarIBM1 Jan 15, 2025
9f4cf26
Doc correction
SunithaGudisagarIBM1 Feb 6, 2025
021a0c5
go sdk update
SunithaGudisagarIBM1 Mar 4, 2025
335e83d
Merge branch 'master' into image-usage-constraint
SunithaGudisagarIBM1 Mar 4, 2025
d0e734f
go sdk changes
SunithaGudisagarIBM1 Mar 4, 2025
61693cc
Resource changes
SunithaGudisagarIBM1 Mar 4, 2025
316e89a
Image resource changes
SunithaGudisagarIBM1 Mar 4, 2025
a440bb5
Added Allowed Use in volume prototype
SunithaGudisagarIBM1 Mar 4, 2025
a5d190f
Documentation added for volume attachment
SunithaGudisagarIBM1 Mar 4, 2025
847cc84
volumeattachmentprototype changes
SunithaGudisagarIBM1 Mar 5, 2025
9132caa
Allowed Use in Instance Resource
SunithaGudisagarIBM1 Mar 5, 2025
7a3ea38
Instance Template changes
SunithaGudisagarIBM1 Mar 6, 2025
53dd09e
allowed use in bare-metal-server-disk
SunithaGudisagarIBM1 Mar 10, 2025
acecaa1
method name change
SunithaGudisagarIBM1 Mar 10, 2025
d4fe018
bare metal server doc fixes
SunithaGudisagarIBM1 Mar 10, 2025
36d22aa
Image Docs correction
SunithaGudisagarIBM1 Mar 10, 2025
86471a7
Snapshot doc changes
SunithaGudisagarIBM1 Mar 10, 2025
11b3146
Volume doc fix
SunithaGudisagarIBM1 Mar 10, 2025
396ecda
Volume attchment doc change
SunithaGudisagarIBM1 Mar 10, 2025
090aa4f
instance template doc correction
SunithaGudisagarIBM1 Mar 10, 2025
489d76a
Instance doc change
SunithaGudisagarIBM1 Mar 10, 2025
97c6da1
baremetal server doc change
SunithaGudisagarIBM1 Mar 10, 2025
5682489
Instance Template change
SunithaGudisagarIBM1 Mar 12, 2025
c2ef22e
Added maturity
SunithaGudisagarIBM1 Jun 30, 2025
e19aaf1
added maturity
SunithaGudisagarIBM1 Jul 2, 2025
f41670e
Merge branch 'master' into image-usage-constraint
SunithaGudisagarIBM1 Jul 2, 2025
921f51c
get SDK to latest version and make required changes
SunithaGudisagarIBM1 Jul 5, 2025
26eb47c
maturity added
SunithaGudisagarIBM1 Jul 7, 2025
71d7ea9
Upgrated SDK to 0.70.0
SunithaGudisagarIBM1 Jul 15, 2025
9245114
Acceptance testing changes
SunithaGudisagarIBM1 Jul 15, 2025
a145736
Instance Template changes
SunithaGudisagarIBM1 Jul 15, 2025
d756015
source snapshot for instance template
SunithaGudisagarIBM1 Jul 16, 2025
a74e0bb
Doc update
SunithaGudisagarIBM1 Jul 16, 2025
e501797
Source Snapshot added to instance template at volume prototype
SunithaGudisagarIBM1 Jul 16, 2025
6b53f43
allowed_use updated
SunithaGudisagarIBM1 Jul 17, 2025
a1b676f
Documentation fix
SunithaGudisagarIBM1 Jul 17, 2025
bdf9ab9
Added support for source_snapshot on instance template
uibm Jul 17, 2025
6338dd8
bare-metal-server and disk instance support removed
SunithaGudisagarIBM1 Jul 18, 2025
41d5333
Merge branch 'it-template-source' into image-usage-constraint
SunithaGudisagarIBM1 Jul 18, 2025
560cbfd
instance-template issue solved
SunithaGudisagarIBM1 Jul 18, 2025
cd8bc79
Instance template rebase changes
SunithaGudisagarIBM1 Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.11
github.com/IBM/vmware-go-sdk v0.1.3
github.com/IBM/vpc-beta-go-sdk v0.8.0
github.com/IBM/vpc-go-sdk v0.67.1
github.com/IBM/vpc-go-sdk v0.70.1
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ github.com/IBM/vmware-go-sdk v0.1.3 h1:uJL3kwzM0jAKsT6Gj9tE5xT9SZBVXVaJvZdxrSMx8
github.com/IBM/vmware-go-sdk v0.1.3/go.mod h1:OyQKRInGGsBaOyE5LIZCqH7b1DZ01BvIYa8BgGy+wWo=
github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE=
github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE=
github.com/IBM/vpc-go-sdk v0.67.1 h1:z0q1af1iItV4kHgreM21vzZtw6XQ13og2GBkX7WCJ8c=
github.com/IBM/vpc-go-sdk v0.67.1/go.mod h1:VL7sy61ybg6tvA60SepoQx7TFe20m7JyNUt+se2tHP4=
github.com/IBM/vpc-go-sdk v0.70.1 h1:6NsbRkiA5gDNxe7cjNx8Pi1j9s0PlhwNQj29wsKZxAo=
github.com/IBM/vpc-go-sdk v0.70.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
Expand Down
14 changes: 14 additions & 0 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ var (
InstanceName string
InstanceProfileName string
InstanceProfileNameUpdate string
ISCatalogImageName string
ISBootSnapshotID string
IsBareMetalServerProfileName string
IsBareMetalServerImage string
IsBareMetalServerImage2 string
Expand Down Expand Up @@ -972,6 +974,18 @@ func init() {
fmt.Println("[INFO] Set the environment variable SL_INSTANCE_PROFILE_UPDATE for testing ibm_is_instance resource else it is set to default value 'cx2-4x8'")
}

ISCatalogImageName = os.Getenv("IS_CATALOG_IMAGE_NAME")
if ISCatalogImageName == "" {
ISCatalogImageName = "test-catalog"
fmt.Println("[INFO] Set the environment variable IS_CATALOG_IMAGE_NAME for testing ibm_is_instance_template resource else it is set to default value 'test-catalog'")
}

ISBootSnapshotID = os.Getenv("IS_BOOT_SNAPSHOT_ID")
if ISBootSnapshotID == "" {
ISBootSnapshotID = "r006-d7fejbe-2dhj-442df-b2iha-ccjbecbjbcejce"
fmt.Println("[INFO] Set the environment variable IS_BOOT_SNAPSHOT_ID for testing ibm_is_instance_template resource else it is set to default value 'r006-d7fejbe-2dhj-442df-b2iha-ccjbecbjbcejce'")
}

IsBareMetalServerProfileName = os.Getenv("IS_BARE_METAL_SERVER_PROFILE")
if IsBareMetalServerProfileName == "" {
IsBareMetalServerProfileName = "bx2-metal-96x384" // for next gen infrastructure
Expand Down
92 changes: 48 additions & 44 deletions ibm/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,50 +488,52 @@ func Provider() *schema.Provider {
"ibm_is_instance_cluster_network_attachment": vpc.DataSourceIBMIsInstanceClusterNetworkAttachment(),
"ibm_is_instance_cluster_network_attachments": vpc.DataSourceIBMIsInstanceClusterNetworkAttachments(),

"ibm_is_dedicated_host": vpc.DataSourceIbmIsDedicatedHost(),
"ibm_is_dedicated_hosts": vpc.DataSourceIbmIsDedicatedHosts(),
"ibm_is_dedicated_host_profile": vpc.DataSourceIbmIsDedicatedHostProfile(),
"ibm_is_dedicated_host_profiles": vpc.DataSourceIbmIsDedicatedHostProfiles(),
"ibm_is_dedicated_host_group": vpc.DataSourceIbmIsDedicatedHostGroup(),
"ibm_is_dedicated_host_groups": vpc.DataSourceIbmIsDedicatedHostGroups(),
"ibm_is_dedicated_host_disk": vpc.DataSourceIbmIsDedicatedHostDisk(),
"ibm_is_dedicated_host_disks": vpc.DataSourceIbmIsDedicatedHostDisks(),
"ibm_is_placement_group": vpc.DataSourceIbmIsPlacementGroup(),
"ibm_is_placement_groups": vpc.DataSourceIbmIsPlacementGroups(),
"ibm_is_floating_ip": vpc.DataSourceIBMISFloatingIP(),
"ibm_is_floating_ips": vpc.DataSourceIBMIsFloatingIps(),
"ibm_is_flow_log": vpc.DataSourceIBMIsFlowLog(),
"ibm_is_flow_logs": vpc.DataSourceIBMISFlowLogs(),
"ibm_is_image": vpc.DataSourceIBMISImage(),
"ibm_is_images": vpc.DataSourceIBMISImages(),
"ibm_is_image_export_job": vpc.DataSourceIBMIsImageExport(),
"ibm_is_image_export_jobs": vpc.DataSourceIBMIsImageExports(),
"ibm_is_endpoint_gateway_targets": vpc.DataSourceIBMISEndpointGatewayTargets(),
"ibm_is_instance_group": vpc.DataSourceIBMISInstanceGroup(),
"ibm_is_instance_groups": vpc.DataSourceIBMISInstanceGroups(),
"ibm_is_instance_group_memberships": vpc.DataSourceIBMISInstanceGroupMemberships(),
"ibm_is_instance_group_membership": vpc.DataSourceIBMISInstanceGroupMembership(),
"ibm_is_instance_group_manager": vpc.DataSourceIBMISInstanceGroupManager(),
"ibm_is_instance_group_managers": vpc.DataSourceIBMISInstanceGroupManagers(),
"ibm_is_instance_group_manager_policies": vpc.DataSourceIBMISInstanceGroupManagerPolicies(),
"ibm_is_instance_group_manager_policy": vpc.DataSourceIBMISInstanceGroupManagerPolicy(),
"ibm_is_instance_group_manager_action": vpc.DataSourceIBMISInstanceGroupManagerAction(),
"ibm_is_instance_group_manager_actions": vpc.DataSourceIBMISInstanceGroupManagerActions(),
"ibm_is_virtual_endpoint_gateways": vpc.DataSourceIBMISEndpointGateways(),
"ibm_is_virtual_endpoint_gateway_ips": vpc.DataSourceIBMISEndpointGatewayIPs(),
"ibm_is_virtual_endpoint_gateway": vpc.DataSourceIBMISEndpointGateway(),
"ibm_is_instance_template": vpc.DataSourceIBMISInstanceTemplate(),
"ibm_is_instance_templates": vpc.DataSourceIBMISInstanceTemplates(),
"ibm_is_instance_profile": vpc.DataSourceIBMISInstanceProfile(),
"ibm_is_instance_profiles": vpc.DataSourceIBMISInstanceProfiles(),
"ibm_is_instance": vpc.DataSourceIBMISInstance(),
"ibm_is_instances": vpc.DataSourceIBMISInstances(),
"ibm_is_instance_network_attachment": vpc.DataSourceIBMIsInstanceNetworkAttachment(),
"ibm_is_instance_network_attachments": vpc.DataSourceIBMIsInstanceNetworkAttachments(),
"ibm_is_instance_network_interface": vpc.DataSourceIBMIsInstanceNetworkInterface(),
"ibm_is_instance_network_interfaces": vpc.DataSourceIBMIsInstanceNetworkInterfaces(),
"ibm_is_instance_disk": vpc.DataSourceIbmIsInstanceDisk(),
"ibm_is_instance_disks": vpc.DataSourceIbmIsInstanceDisks(),
"ibm_is_dedicated_host": vpc.DataSourceIbmIsDedicatedHost(),
"ibm_is_dedicated_hosts": vpc.DataSourceIbmIsDedicatedHosts(),
"ibm_is_dedicated_host_profile": vpc.DataSourceIbmIsDedicatedHostProfile(),
"ibm_is_dedicated_host_profiles": vpc.DataSourceIbmIsDedicatedHostProfiles(),
"ibm_is_dedicated_host_group": vpc.DataSourceIbmIsDedicatedHostGroup(),
"ibm_is_dedicated_host_groups": vpc.DataSourceIbmIsDedicatedHostGroups(),
"ibm_is_dedicated_host_disk": vpc.DataSourceIbmIsDedicatedHostDisk(),
"ibm_is_dedicated_host_disks": vpc.DataSourceIbmIsDedicatedHostDisks(),
"ibm_is_placement_group": vpc.DataSourceIbmIsPlacementGroup(),
"ibm_is_placement_groups": vpc.DataSourceIbmIsPlacementGroups(),
"ibm_is_floating_ip": vpc.DataSourceIBMISFloatingIP(),
"ibm_is_floating_ips": vpc.DataSourceIBMIsFloatingIps(),
"ibm_is_flow_log": vpc.DataSourceIBMIsFlowLog(),
"ibm_is_flow_logs": vpc.DataSourceIBMISFlowLogs(),
"ibm_is_image": vpc.DataSourceIBMISImage(),
"ibm_is_images": vpc.DataSourceIBMISImages(),
"ibm_is_image_bare_metal_server_profiles": vpc.DataSourceIBMIsImageBareMetalServerProfiles(),
"ibm_is_image_instance_profiles": vpc.DataSourceIBMIsImageInstanceProfiles(),
"ibm_is_image_export_job": vpc.DataSourceIBMIsImageExport(),
"ibm_is_image_export_jobs": vpc.DataSourceIBMIsImageExports(),
"ibm_is_endpoint_gateway_targets": vpc.DataSourceIBMISEndpointGatewayTargets(),
"ibm_is_instance_group": vpc.DataSourceIBMISInstanceGroup(),
"ibm_is_instance_groups": vpc.DataSourceIBMISInstanceGroups(),
"ibm_is_instance_group_memberships": vpc.DataSourceIBMISInstanceGroupMemberships(),
"ibm_is_instance_group_membership": vpc.DataSourceIBMISInstanceGroupMembership(),
"ibm_is_instance_group_manager": vpc.DataSourceIBMISInstanceGroupManager(),
"ibm_is_instance_group_managers": vpc.DataSourceIBMISInstanceGroupManagers(),
"ibm_is_instance_group_manager_policies": vpc.DataSourceIBMISInstanceGroupManagerPolicies(),
"ibm_is_instance_group_manager_policy": vpc.DataSourceIBMISInstanceGroupManagerPolicy(),
"ibm_is_instance_group_manager_action": vpc.DataSourceIBMISInstanceGroupManagerAction(),
"ibm_is_instance_group_manager_actions": vpc.DataSourceIBMISInstanceGroupManagerActions(),
"ibm_is_virtual_endpoint_gateways": vpc.DataSourceIBMISEndpointGateways(),
"ibm_is_virtual_endpoint_gateway_ips": vpc.DataSourceIBMISEndpointGatewayIPs(),
"ibm_is_virtual_endpoint_gateway": vpc.DataSourceIBMISEndpointGateway(),
"ibm_is_instance_template": vpc.DataSourceIBMISInstanceTemplate(),
"ibm_is_instance_templates": vpc.DataSourceIBMISInstanceTemplates(),
"ibm_is_instance_profile": vpc.DataSourceIBMISInstanceProfile(),
"ibm_is_instance_profiles": vpc.DataSourceIBMISInstanceProfiles(),
"ibm_is_instance": vpc.DataSourceIBMISInstance(),
"ibm_is_instances": vpc.DataSourceIBMISInstances(),
"ibm_is_instance_network_attachment": vpc.DataSourceIBMIsInstanceNetworkAttachment(),
"ibm_is_instance_network_attachments": vpc.DataSourceIBMIsInstanceNetworkAttachments(),
"ibm_is_instance_network_interface": vpc.DataSourceIBMIsInstanceNetworkInterface(),
"ibm_is_instance_network_interfaces": vpc.DataSourceIBMIsInstanceNetworkInterfaces(),
"ibm_is_instance_disk": vpc.DataSourceIbmIsInstanceDisk(),
"ibm_is_instance_disks": vpc.DataSourceIbmIsInstanceDisks(),

// reserved ips
"ibm_is_instance_network_interface_reserved_ip": vpc.DataSourceIBMISInstanceNICReservedIP(),
Expand Down Expand Up @@ -587,6 +589,7 @@ func Provider() *schema.Provider {
"ibm_is_snapshot_consistency_group": vpc.DataSourceIBMIsSnapshotConsistencyGroup(),
"ibm_is_snapshot_consistency_groups": vpc.DataSourceIBMIsSnapshotConsistencyGroups(),
"ibm_is_snapshots": vpc.DataSourceSnapshots(),
"ibm_is_snapshot_instance_profiles": vpc.DataSourceIBMIsSnapshotInstanceProfiles(),
"ibm_is_share": vpc.DataSourceIbmIsShare(),
"ibm_is_source_share": vpc.DataSourceIbmIsSourceShare(),
"ibm_is_shares": vpc.DataSourceIbmIsShares(),
Expand All @@ -612,6 +615,7 @@ func Provider() *schema.Provider {
"ibm_is_volumes": vpc.DataSourceIBMIsVolumes(),
"ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(),
"ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(),
"ibm_is_volume_instance_profiles": vpc.DataSourceIBMIsVolumeInstanceProfiles(),
"ibm_is_vpc": vpc.DataSourceIBMISVPC(),
"ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(),
"ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(),
Expand Down
29 changes: 29 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ func DataSourceIBMIsBareMetalServer() *schema.Resource {
Computed: true,
Description: "The size of the disk in GB (gigabytes)",
},
"allowed_use": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "The usage constraints to be matched against the requested bare metal server properties to determine compatibility.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bare_metal_server": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in this disk.",
},
"api_version": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The API version with which to evaluate the expressions.",
},
},
},
},
},
},
},
Expand Down Expand Up @@ -1029,6 +1048,16 @@ func dataSourceIBMISBareMetalServerRead(context context.Context, d *schema.Resou
isBareMetalServerDiskResourceType: disk.ResourceType,
isBareMetalServerDiskSize: disk.Size,
}
if disk.AllowedUse != nil {
usageConstraintList := []map[string]interface{}{}
modelMap, err := ResourceceIBMIsBareMetalServerDiskAllowedUseToMap(disk.AllowedUse)
if err != nil {
tfErr := flex.TerraformErrorf(err, err.Error(), "(Resource) ibm_is_bare_metal_server", "read")
log.Println(tfErr.GetDiag())
}
usageConstraintList = append(usageConstraintList, modelMap)
currentDisk["allowed_use"] = usageConstraintList
}
diskList = append(diskList, currentDisk)
}
}
Expand Down
31 changes: 30 additions & 1 deletion ibm/service/vpc/data_source_ibm_is_bare_metal_server_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ func DataSourceIBMIsBareMetalServerDisk() *schema.Resource {
Computed: true,
Description: "The size of the disk in GB (gigabytes)",
},
"allowed_use": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "The usage constraints to be matched against the requested bare metal server properties to determine compatibility.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bare_metal_server": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in this disk.",
},
"api_version": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The API version with which to evaluate the expressions.",
},
},
},
},
},
}
}
Expand Down Expand Up @@ -107,6 +126,16 @@ func dataSourceIBMISBareMetalServerDiskRead(context context.Context, d *schema.R
if err = d.Set("size", flex.IntValue(bareMetalServerDisk.Size)); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting size: %s", err), "(Data) ibm_is_bare_metal_server_disk", "read", "set-size").GetDiag()
}

allowedUses := []map[string]interface{}{}
if bareMetalServerDisk.AllowedUse != nil {
modelMap, err := ResourceceIBMIsBareMetalServerDiskAllowedUseToMap(bareMetalServerDisk.AllowedUse)
if err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting allowed_use: %s", err), "(Data) ibm_is_bare_metal_server_disk", "read", "set-allowed_use").GetDiag()
}
allowedUses = append(allowedUses, modelMap)
}
if err = d.Set("allowed_use", allowedUses); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting allowed_use: %s", err), "(Data) ibm_is_bare_metal_server_disk", "read", "set-allowed_use").GetDiag()
}
return nil
}
29 changes: 29 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_bare_metal_server_disks.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ func DataSourceIBMIsBareMetalServerDisks() *schema.Resource {
Computed: true,
Description: "The size of the disk in GB (gigabytes)",
},
"allowed_use": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "The usage constraints to be matched against the requested bare metal server properties to determine compatibility.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bare_metal_server": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in this disk.",
},
"api_version": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The API version with which to evaluate the expressions.",
},
},
},
},
},
},
},
Expand Down Expand Up @@ -107,8 +126,18 @@ func dataSourceIBMISBareMetalServerDisksRead(context context.Context, d *schema.
isBareMetalServerDiskResourceType: disk.ResourceType,
isBareMetalServerDiskSize: disk.Size,
}
if disk.AllowedUse != nil {
usageConstraintList := []map[string]interface{}{}
modelMap, err := ResourceceIBMIsBareMetalServerDiskAllowedUseToMap(disk.AllowedUse)
if err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting allowed_use: %s", err), "(Data) ibm_is_bare_metal_server_disks", "read", "set-allowed_use").GetDiag()
}
usageConstraintList = append(usageConstraintList, modelMap)
l["allowed_use"] = usageConstraintList
}
disksInfo = append(disksInfo, l)
}

d.SetId(dataSourceIBMISBMSDisksID(d))
if err = d.Set(isBareMetalServerDisks, disksInfo); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting disks: %s", err), "(Data) ibm_is_bare_metal_server_disks", "read", "set-disks").GetDiag()
Expand Down
29 changes: 29 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,25 @@ func DataSourceIBMIsBareMetalServers() *schema.Resource {
Computed: true,
Description: "The size of the disk in GB (gigabytes)",
},
"allowed_use": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "The usage constraints to be matched against the requested bare metal server properties to determine compatibility.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bare_metal_server": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in this disk.",
},
"api_version": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The API version with which to evaluate the expressions.",
},
},
},
},
},
},
},
Expand Down Expand Up @@ -1045,6 +1064,16 @@ func dataSourceIBMISBareMetalServersRead(context context.Context, d *schema.Reso
isBareMetalServerDiskResourceType: disk.ResourceType,
isBareMetalServerDiskSize: disk.Size,
}
if disk.AllowedUse != nil {
usageConstraintList := []map[string]interface{}{}
modelMap, err := ResourceceIBMIsBareMetalServerDiskAllowedUseToMap(disk.AllowedUse)
if err != nil {
tfErr := flex.TerraformErrorf(err, err.Error(), "(Resource) ibm_is_bare_metal_server", "read")
log.Println(tfErr.GetDiag())
}
usageConstraintList = append(usageConstraintList, modelMap)
currentDisk["allowed_use"] = usageConstraintList
}
diskList = append(diskList, currentDisk)
}
}
Expand Down
Loading
Loading