Skip to content

Commit 0b798f0

Browse files
feat(regional-share): Support for regional file shares (IBM-Cloud#6465)
* feat(regional-share): Support for regional file shares * updates to docs and test * updates to shares * updates to shares * handle breaking change: transit encryption default values based on profiles * doc update * update document description * updated SDK * updates to SDK and other schema items * update SA notes and diff suppress * make transit encryption default to none, as per team suggestion * Fix review comments * transit encryption user_managed to ipsec in default handling and more checks --------- Co-authored-by: Deepak Selvakumar <[email protected]>
1 parent db591ef commit 0b798f0

27 files changed

+1037
-57
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ require (
3838
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.15
3939
github.com/IBM/vmware-go-sdk v0.1.5
4040
github.com/IBM/vpc-beta-go-sdk v0.8.0
41-
github.com/IBM/vpc-go-sdk v0.71.1
41+
github.com/IBM/vpc-go-sdk v0.72.0
4242
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
4343
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
4444
github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,8 @@ github.com/IBM/vmware-go-sdk v0.1.5 h1:aQbwcJBceaaauuIoJ0OJn+ttwjb+QTX6XV9Jbrdpj
169169
github.com/IBM/vmware-go-sdk v0.1.5/go.mod h1:OyQKRInGGsBaOyE5LIZCqH7b1DZ01BvIYa8BgGy+wWo=
170170
github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE=
171171
github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE=
172-
github.com/IBM/vpc-go-sdk v0.70.1 h1:6NsbRkiA5gDNxe7cjNx8Pi1j9s0PlhwNQj29wsKZxAo=
173-
github.com/IBM/vpc-go-sdk v0.70.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
174-
github.com/IBM/vpc-go-sdk v0.71.1 h1:SP5/uQs5JDb1QRvSJ1QC2BzE+BHEMq4jd2+JEcRuieE=
175-
github.com/IBM/vpc-go-sdk v0.71.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
172+
github.com/IBM/vpc-go-sdk v0.72.0 h1:3Pj7nNuYmlaRPiMyC/5Uro3+5hzNBM6v2Lrq5UABBkQ=
173+
github.com/IBM/vpc-go-sdk v0.72.0/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
176174
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
177175
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc=
178176
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=

ibm/service/vpc/data_source_ibm_is_share.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,28 @@ func DataSourceIbmIsShare() *schema.Resource {
3535
ExactlyOneOf: []string{"share", "name"},
3636
Description: "Name of the share.",
3737
},
38+
"availability_mode": {
39+
Type: schema.TypeString,
40+
Computed: true,
41+
Description: "Availability mode of the share.",
42+
},
3843
"allowed_transit_encryption_modes": {
3944
Type: schema.TypeList,
4045
Computed: true,
4146
Elem: &schema.Schema{Type: schema.TypeString},
4247
Description: "Allowed transit encryption modes",
4348
},
49+
"allowed_access_protocols": {
50+
Type: schema.TypeList,
51+
Computed: true,
52+
Elem: &schema.Schema{Type: schema.TypeString},
53+
Description: "Allowed access protocols for this share",
54+
},
55+
"bandwidth": {
56+
Type: schema.TypeInt,
57+
Computed: true,
58+
Description: "The bandwidth for this share.",
59+
},
4460
"created_at": {
4561
Type: schema.TypeString,
4662
Computed: true,
@@ -590,6 +606,11 @@ func DataSourceIbmIsShare() *schema.Resource {
590606
},
591607
},
592608
},
609+
"storage_generation": {
610+
Type: schema.TypeInt,
611+
Computed: true,
612+
Description: "The storage generation for this share",
613+
},
593614
},
594615
}
595616
}
@@ -699,12 +720,27 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m
699720
if share.AccessControlMode != nil {
700721
d.Set("access_control_mode", *share.AccessControlMode)
701722
}
723+
if share.AvailabilityMode != nil {
724+
if err = d.Set("availability_mode", *share.AvailabilityMode); err != nil {
725+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-availability_mode").GetDiag()
726+
}
727+
}
702728
if !core.IsNil(share.AllowedTransitEncryptionModes) {
703729
if err = d.Set("allowed_transit_encryption_modes", share.AllowedTransitEncryptionModes); err != nil {
704730
err = fmt.Errorf("Error setting allowed_transit_encryption_modes: %s", err)
705731
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_transit_encryption_modes").GetDiag()
706732
}
707733
}
734+
if !core.IsNil(share.AllowedAccessProtocols) {
735+
if err = d.Set("allowed_access_protocols", share.AllowedAccessProtocols); err != nil {
736+
err = fmt.Errorf("Error setting allowed_access_protocols: %s", err)
737+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-allowed_access_protocols").GetDiag()
738+
}
739+
}
740+
if err = d.Set("bandwidth", share.Bandwidth); err != nil {
741+
err = fmt.Errorf("Error setting bandwidth: %s", err)
742+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-bandwidth").GetDiag()
743+
}
708744
if err = d.Set("accessor_binding_role", share.AccessorBindingRole); err != nil {
709745
err = fmt.Errorf("Error setting accessor_binding_role: %s", err)
710746
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_is_share", "read", "set-accessor_binding_role").GetDiag()
@@ -821,6 +857,10 @@ func dataSourceIbmIsShareRead(context context.Context, d *schema.ResourceData, m
821857
if err = d.Set("source_snapshot", sourceSnapshot); err != nil {
822858
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting source_snapshot: %s", err), "(Data) ibm_is_share", "read", "set-source_snapshot").GetDiag()
823859
}
860+
861+
if err := d.Set("storage_generation", flex.IntValue(share.StorageGeneration)); err != nil {
862+
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting storage_generation: %s", err), "(Data) ibm_is_share", "read", "set-storage_generation").GetDiag()
863+
}
824864
accesstags, err := flex.GetGlobalTagsUsingCRN(meta, *share.CRN, "", isAccessTagType)
825865
if err != nil {
826866
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting shares (%s) access tags: %s", d.Id(), err), "(Data) ibm_is_share", "read")

ibm/service/vpc/data_source_ibm_is_share_accessor_binding_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestAccIBMIsShareAccessorBindingDataSourceBasic(t *testing.T) {
2626
vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100))
2727
shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100))
2828
shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100))
29-
tEMode1 := "user_managed"
29+
tEMode1 := "ipsec"
3030
resource.Test(t, resource.TestCase{
3131
PreCheck: func() { acc.TestAccPreCheck(t) },
3232
Providers: acc.TestAccProviders,

ibm/service/vpc/data_source_ibm_is_share_accessor_bindings_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestAccIBMIsShareAccessorBindingsDataSourceBasic(t *testing.T) {
2727
vpcname := fmt.Sprintf("tf-vpc-name-%d", acctest.RandIntRange(10, 100))
2828
shareName := fmt.Sprintf("tf-share-%d", acctest.RandIntRange(10, 100))
2929
shareName1 := fmt.Sprintf("tf-share1-%d", acctest.RandIntRange(10, 100))
30-
tEMode1 := "user_managed"
30+
tEMode1 := "ipsec"
3131
resource.Test(t, resource.TestCase{
3232
PreCheck: func() { acc.TestAccPreCheck(t) },
3333
Providers: acc.TestAccProviders,

ibm/service/vpc/data_source_ibm_is_share_mount_target.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ func DataSourceIBMIsShareTarget() *schema.Resource {
4242
ExactlyOneOf: []string{"mount_target", "mount_target_name"},
4343
Description: "The share target name.",
4444
},
45+
"access_protocol": {
46+
Type: schema.TypeString,
47+
Computed: true,
48+
Description: "The protocol to use to access the share for this share mount target.",
49+
},
4550
"transit_encryption": {
4651
Type: schema.TypeString,
4752
Computed: true,
@@ -368,6 +373,12 @@ func dataSourceIBMIsShareTargetRead(context context.Context, d *schema.ResourceD
368373
err = fmt.Errorf("Error setting resource_type: %s", err)
369374
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_mount_target", "read", "set-resource_type").GetDiag()
370375
}
376+
if shareTarget.AccessProtocol != nil {
377+
if err := d.Set("access_protocol", *shareTarget.AccessProtocol); err != nil {
378+
err = fmt.Errorf("Error setting access_protocol: %s", err)
379+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_share_mount_target", "read", "set-access_protocol").GetDiag()
380+
}
381+
}
371382
if shareTarget.TransitEncryption != nil {
372383
if err = d.Set("transit_encryption", *shareTarget.TransitEncryption); err != nil {
373384
err = fmt.Errorf("Error setting transit_encryption: %s", err)

ibm/service/vpc/data_source_ibm_is_share_mount_targets.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ func DataSourceIBMIsShareTargets() *schema.Resource {
4343
Computed: true,
4444
Description: "The access control mode for the share",
4545
},
46+
"access_protocol": {
47+
Type: schema.TypeString,
48+
Computed: true,
49+
Description: "The protocol to use to access the share for this share mount target.",
50+
},
4651
"name": {
4752
Type: schema.TypeString,
4853
Computed: true,
@@ -346,6 +351,9 @@ func dataSourceShareMountTargetCollectionTargetsToMap(targetsItem vpcv1.ShareMou
346351
if targetsItem.AccessControlMode != nil {
347352
targetsMap["access_control_mode"] = *targetsItem.AccessControlMode
348353
}
354+
if targetsItem.AccessProtocol != nil {
355+
targetsMap["access_protocol"] = *targetsItem.AccessProtocol
356+
}
349357
if targetsItem.CreatedAt != nil {
350358
targetsMap["created_at"] = targetsItem.CreatedAt.String()
351359
}

0 commit comments

Comments
 (0)