Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.15
github.com/IBM/vmware-go-sdk v0.1.5
github.com/IBM/vpc-beta-go-sdk v0.8.0
github.com/IBM/vpc-go-sdk v0.71.1
github.com/IBM/vpc-go-sdk v0.72.0
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
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,8 @@ github.com/IBM/vmware-go-sdk v0.1.5 h1:aQbwcJBceaaauuIoJ0OJn+ttwjb+QTX6XV9Jbrdpj
github.com/IBM/vmware-go-sdk v0.1.5/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.70.1 h1:6NsbRkiA5gDNxe7cjNx8Pi1j9s0PlhwNQj29wsKZxAo=
github.com/IBM/vpc-go-sdk v0.70.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
github.com/IBM/vpc-go-sdk v0.71.1 h1:SP5/uQs5JDb1QRvSJ1QC2BzE+BHEMq4jd2+JEcRuieE=
github.com/IBM/vpc-go-sdk v0.71.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
github.com/IBM/vpc-go-sdk v0.72.0 h1:3Pj7nNuYmlaRPiMyC/5Uro3+5hzNBM6v2Lrq5UABBkQ=
github.com/IBM/vpc-go-sdk v0.72.0/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/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
Expand Down
40 changes: 40 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,28 @@ func DataSourceIbmIsShare() *schema.Resource {
ExactlyOneOf: []string{"share", "name"},
Description: "Name of the share.",
},
"availability_mode": {
Type: schema.TypeString,
Computed: true,
Description: "Availability mode of the share.",
},
"allowed_transit_encryption_modes": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "Allowed transit encryption modes",
},
"allowed_access_protocols": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "Allowed access protocols for this share",
},
"bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "The bandwidth for this share.",
},
"created_at": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -590,6 +606,11 @@ func DataSourceIbmIsShare() *schema.Resource {
},
},
},
"storage_generation": {
Type: schema.TypeInt,
Computed: true,
Description: "The storage generation for this share",
},
},
}
}
Expand Down Expand Up @@ -699,12 +720,27 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m
if share.AccessControlMode != nil {
d.Set("access_control_mode", *share.AccessControlMode)
}
if share.AvailabilityMode != nil {
if err = d.Set("availability_mode", *share.AvailabilityMode); err != nil {
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-availability_mode").GetDiag()
}
}
if !core.IsNil(share.AllowedTransitEncryptionModes) {
if err = d.Set("allowed_transit_encryption_modes", share.AllowedTransitEncryptionModes); err != nil {
err = fmt.Errorf("Error setting allowed_transit_encryption_modes: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_transit_encryption_modes").GetDiag()
}
}
if !core.IsNil(share.AllowedAccessProtocols) {
if err = d.Set("allowed_access_protocols", share.AllowedAccessProtocols); err != nil {
err = fmt.Errorf("Error setting allowed_access_protocols: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_access_protocols").GetDiag()
}
}
if err = d.Set("bandwidth", share.Bandwidth); err != nil {
err = fmt.Errorf("Error setting bandwidth: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-bandwidth").GetDiag()
}
if err = d.Set("accessor_binding_role", share.AccessorBindingRole); err != nil {
err = fmt.Errorf("Error setting accessor_binding_role: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-accessor_binding_role").GetDiag()
Expand Down Expand Up @@ -821,6 +857,10 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m
if err = d.Set("source_snapshot", sourceSnapshot); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting source_snapshot: %s", err), "(Data) ibm_is_share", "read", "set-source_snapshot").GetDiag()
}

if err := d.Set("storage_generation", flex.IntValue(share.StorageGeneration)); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting storage_generation: %s", err), "(Data) ibm_is_share", "read", "set-storage_generation").GetDiag()
}
accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *share.CRN, "", isAccessTagType)
if err != nil {
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting shares (%s) access tags: %s", d.Id(), err), "(Data) ibm_is_share", "read")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestAccIBMIsShareAccessorBindingDataSourceBasic(t *testing.T) {
vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100))
shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100))
shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100))
tEMode1 := "user_managed"
tEMode1 := "ipsec"
resource.Test(t, resource.TestCase{
PreCheck: func() { acc.TestAccPreCheck(t) },
Providers: acc.TestAccProviders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAccIBMIsShareAccessorBindingsDataSourceBasic(t *testing.T) {
vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100))
shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100))
shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100))
tEMode1 := "user_managed"
tEMode1 := "ipsec"
resource.Test(t, resource.TestCase{
PreCheck: func() { acc.TestAccPreCheck(t) },
Providers: acc.TestAccProviders,
Expand Down
11 changes: 11 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_share_mount_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func DataSourceIBMIsShareTarget() *schema.Resource {
ExactlyOneOf: []string{"mount_target", "mount_target_name"},
Description: "The share target name.",
},
"access_protocol": {
Type: schema.TypeString,
Computed: true,
Description: "The protocol to use to access the share for this share mount target.",
},
"transit_encryption": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -368,6 +373,12 @@ func dataSourceIBMIsShareTargetRead(context context.Context, d *schema.ResourceD
err = fmt.Errorf("Error setting resource_type: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_mount_target", "read", "set-resource_type").GetDiag()
}
if shareTarget.AccessProtocol != nil {
if err := d.Set("access_protocol", *shareTarget.AccessProtocol); err != nil {
err = fmt.Errorf("Error setting access_protocol: %s", err)
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_mount_target", "read", "set-access_protocol").GetDiag()
}
}
if shareTarget.TransitEncryption != nil {
if err = d.Set("transit_encryption", *shareTarget.TransitEncryption); err != nil {
err = fmt.Errorf("Error setting transit_encryption: %s", err)
Expand Down
8 changes: 8 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_share_mount_targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func DataSourceIBMIsShareTargets() *schema.Resource {
Computed: true,
Description: "The access control mode for the share",
},
"access_protocol": {
Type: schema.TypeString,
Computed: true,
Description: "The protocol to use to access the share for this share mount target.",
},
"name": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -346,6 +351,9 @@ func dataSourceShareMountTargetCollectionTargetsToMap(targetsItem vpcv1.ShareMou
if targetsItem.AccessControlMode != nil {
targetsMap["access_control_mode"] = *targetsItem.AccessControlMode
}
if targetsItem.AccessProtocol != nil {
targetsMap["access_protocol"] = *targetsItem.AccessProtocol
}
if targetsItem.CreatedAt != nil {
targetsMap["created_at"] = targetsItem.CreatedAt.String()
}
Expand Down
Loading
Loading