Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(PPS): Add support for private path service gateway and private path load balancer #5712

Merged
merged 64 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
7fb52b1
Feature: private path network load balancers
deepaksibm Jan 17, 2023
f4866fc
private path service datasources
deepaksibm Jan 30, 2023
97b5bbb
private path service resource and test cases
deepaksibm Feb 3, 2023
a5262e7
additional resources
deepaksibm Feb 3, 2023
026ebe5
doc and test fix
deepaksibm Feb 5, 2023
120baa3
doc added for ppsg
deepaksibm Feb 6, 2023
99aac7f
endpoint gateway changes
deepaksibm Feb 6, 2023
562c53b
test case update
deepaksibm Feb 6, 2023
bd749ff
provider go changes
deepaksibm Feb 9, 2023
3cd1a4a
removed total_count from data source
deepaksibm Feb 9, 2023
38c670b
sdk maturity changes
deepaksibm Feb 9, 2023
9ed5d6b
make fmt changes
deepaksibm Feb 10, 2023
1f83d04
attributes added to lb and lb profile
deepaksibm Feb 11, 2023
7f229f0
api changes
deepaksibm Feb 14, 2023
26bbeb8
sdk changes
deepaksibm Feb 17, 2023
30a165a
marking region to omitempty in sdk for ppsg
deepaksibm Feb 18, 2023
6a547b4
pps gateway fix
deepaksibm Mar 6, 2023
20eaecb
sdk update
deepaksibm Mar 6, 2023
c4f9b05
lb temp change
deepaksibm Mar 6, 2023
56517dc
bug and doc fixes
deepaksibm Mar 10, 2023
02821db
updated version
deepaksibm May 22, 2023
2a718a4
updated version
deepaksibm May 22, 2023
2e7fcf4
updated date
deepaksibm May 26, 2023
a82cd84
updated sdk
deepaksibm Nov 20, 2023
f455420
Merge branch 'master' into pps-bundle
deepaksibm Nov 21, 2023
9f44569
code corrections
deepaksibm Nov 22, 2023
2b461f8
updated sdk
deepaksibm Dec 24, 2023
a9f033a
Merge branch 'master' into pps-bundle
deepaksibm Jan 30, 2024
4eac349
merge conflicts fix
deepaksibm Jan 31, 2024
0bbe567
resolve conflicts
deepaksibm Jan 31, 2024
c843dea
schema corrections
deepaksibm Feb 1, 2024
1c15baa
version update
deepaksibm Feb 8, 2024
f24facf
keeping ga maturity for load balancer
deepaksibm Feb 22, 2024
1929ce0
sdk update
deepaksibm Apr 17, 2024
e32f050
Merge branch 'master' into pps-bundle-ga
deepaksibm Apr 17, 2024
e7e7e59
feature(pps-ga): Support for PPS GA changes
deepaksibm Apr 17, 2024
2174e9c
added resource for publish and endpoint gateway operations
deepaksibm Apr 17, 2024
63907f6
sdk update
deepaksibm May 30, 2024
9bf98b7
ppsg operations
deepaksibm Jun 5, 2024
b0a527d
updated maturity in sdk
deepaksibm Jun 5, 2024
497cda8
generation to vpc
deepaksibm Jun 7, 2024
428c1de
sdk version and fixes
deepaksibm Jul 15, 2024
350c29c
sdk
deepaksibm Aug 16, 2024
d9dcbe0
sdk update and fixes
deepaksibm Aug 19, 2024
6bcd311
sdk update
deepaksibm Sep 1, 2024
200358b
Merge branch 'master' into pps-bundle-ga
deepaksibm Sep 1, 2024
e11d333
sdk updates
deepaksibm Sep 2, 2024
9e1dfca
profile name key correction
deepaksibm Sep 2, 2024
fc9fdbb
additional changes
deepaksibm Sep 2, 2024
c52308b
permit deny update and docs
deepaksibm Sep 6, 2024
45ffcc9
remove published as optional
deepaksibm Sep 21, 2024
75dbc1a
Update sdk
deepaksibm Oct 7, 2024
91e56e2
Merge branch 'master' into pps-bundle-ga
deepaksibm Oct 9, 2024
6993168
target crn issue in data source
deepaksibm Oct 10, 2024
93d8d32
doc changes and access modes
deepaksibm Oct 16, 2024
79fe162
published state file reset and egw remove pending state for waiting f…
deepaksibm Oct 17, 2024
1228e4c
doc updates
deepaksibm Oct 17, 2024
301e02b
update endpoint gateway wait logic
deepaksibm Oct 17, 2024
68e7cff
update the order of pending states
deepaksibm Oct 17, 2024
39353ac
Select availability notes
deepaksibm Oct 17, 2024
275e908
doc updates and continuous target to 60 seconds
deepaksibm Oct 18, 2024
11df739
nil check
deepaksibm Oct 18, 2024
2479611
lifecycle reasons and wait logic
deepaksibm Oct 18, 2024
edbde8f
Merge branch 'master' into pps-bundle-ga
uibm Oct 18, 2024
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
12 changes: 12 additions & 0 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
)

var (
AccountId string
AppIDTenantID string
AppIDTestUserEmail string
BackupPolicyJobID string
Expand Down Expand Up @@ -763,6 +764,17 @@ func init() {
fmt.Println("[INFO] Set the environment variable SL_CIDR_2 for testing ibm_is_subnet else it is set to default value '10.240.64.0/24'")
}

AccountId = os.Getenv("IS_ACCOUNT_ID")
if AccountId == "" {
AccountId = "fee82deba12e4c0fb69c3b09d1f12345"
fmt.Println("[INFO] Set the environment variable IS_ACCOUNT_ID for testing private_path_service_gateway_account_policy else it is set to default value 'fee82deba12e4c0fb69c3b09d1f12345'")
}

ISAddressPrefixCIDR = os.Getenv("SL_ADDRESS_PREFIX_CIDR")
if ISAddressPrefixCIDR == "" {
ISAddressPrefixCIDR = "10.120.0.0/24"
fmt.Println("[INFO] Set the environment variable SL_ADDRESS_PREFIX_CIDR for testing ibm_is_vpc_address_prefix else it is set to default value '10.120.0.0/24'")
}
ISCIDR2 = os.Getenv("SL_CIDR_2")
if ISCIDR2 == "" {
ISCIDR2 = "10.240.64.0/24"
Expand Down
449 changes: 231 additions & 218 deletions ibm/provider/provider.go

Large diffs are not rendered by default.

49 changes: 47 additions & 2 deletions ibm/service/vpc/data_source_ibm_is_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
name = "name"
poolAlgorithm = "algorithm"
href = "href"
family = "family"
poolProtocol = "protocol"
poolCreatedAt = "created_at"
poolProvisioningStatus = "provisioning_status"
Expand Down Expand Up @@ -50,6 +51,11 @@ func DataSourceIBMISLB() *schema.Resource {
Required: true,
Description: "Load Balancer name",
},
isLBAccessMode: {
Type: schema.TypeString,
Computed: true,
Description: "The access mode of this load balancer",
},
"dns": {
Type: schema.TypeList,
Computed: true,
Expand All @@ -74,7 +80,21 @@ func DataSourceIBMISLB() *schema.Resource {
Computed: true,
Description: "Load Balancer type",
},

isLBAvailability: {
Type: schema.TypeString,
Computed: true,
Description: "The availability of this load balancer",
},
isLBInstanceGroupsSupported: {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this load balancer supports instance groups.",
},
isLBSourceIPPersistenceSupported: {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this load balancer supports source IP session persistence.",
},
isLBUdpSupported: {
Type: schema.TypeBool,
Computed: true,
Expand All @@ -86,7 +106,11 @@ func DataSourceIBMISLB() *schema.Resource {
Computed: true,
Description: "Load Balancer status",
},

isLbProfile: {
Type: schema.TypeMap,
Computed: true,
Description: "The profile to use for this load balancer",
},
isLBRouteMode: {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -354,6 +378,18 @@ func lbGetByName(d *schema.ResourceData, meta interface{}, name string) error {
for _, lb := range allrecs {
if *lb.Name == name {
d.SetId(*lb.ID)
if lb.Availability != nil {
d.Set(isLBAvailability, *lb.Availability)
}
if lb.AccessMode != nil {
d.Set(isLBAccessMode, *lb.AccessMode)
}
if lb.InstanceGroupsSupported != nil {
d.Set(isLBInstanceGroupsSupported, *lb.InstanceGroupsSupported)
}
if lb.SourceIPSessionPersistenceSupported != nil {
d.Set(isLBSourceIPPersistenceSupported, *lb.SourceIPSessionPersistenceSupported)
}
dnsList := make([]map[string]interface{}, 0)
if lb.Dns != nil {
dns := map[string]interface{}{}
Expand All @@ -368,9 +404,18 @@ func lbGetByName(d *schema.ResourceData, meta interface{}, name string) error {
}
if *lb.IsPublic {
d.Set(isLBType, "public")
} else if lb.IsPrivatePath != nil && *lb.IsPrivatePath {
d.Set(isLBType, "private_path")
} else {
d.Set(isLBType, "private")
}
lbProfile := make(map[string]interface{})
if lb.Profile != nil {
lbProfile[isLBName] = *lb.Profile.Name
lbProfile[href] = *lb.Profile.Href
lbProfile[family] = *lb.Profile.Family
}
d.Set(isLbProfile, lbProfile)
d.Set(isLBStatus, *lb.ProvisioningStatus)
if lb.RouteMode != nil {
d.Set(isLBRouteMode, *lb.RouteMode)
Expand Down
32 changes: 32 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_lb_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ func DataSourceIBMISLbProfile() *schema.Resource {
Required: true,
Description: "The name for this load balancer profile",
},
isLBAccessModes: {
Type: schema.TypeList,
Computed: true,
Description: "The access mode for a load balancer with this profile",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Computed: true,
Description: "The type for access mode",
},
"value": {
Type: schema.TypeString,
Computed: true,
Description: "Access modes for this profile",
},
},
},
},
"href": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -76,6 +95,19 @@ func dataSourceIBMISLbProfileRead(context context.Context, d *schema.ResourceDat
d.Set("name", *lbProfile.Name)
d.Set("href", *lbProfile.Href)
d.Set("family", *lbProfile.Family)
if lbProfile.AccessModes != nil {
accessModes := lbProfile.AccessModes
AccessModesMap := map[string]interface{}{}
AccessModesList := []map[string]interface{}{}
if accessModes.Type != nil {
AccessModesMap["type"] = *accessModes.Type
}
if len(accessModes.Values) > 0 {
AccessModesMap["value"] = accessModes.Values
}
AccessModesList = append(AccessModesList, AccessModesMap)
d.Set(isLBAccessModes, AccessModesList)
}
log.Printf("[INFO] lbprofile udp %v", lbProfile.UDPSupported)
if lbProfile.UDPSupported != nil {
udpSupport := lbProfile.UDPSupported
Expand Down
129 changes: 129 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_lb_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,44 @@ func DataSourceIBMISLbProfiles() *schema.Resource {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
isLBAccessModes: {
Type: schema.TypeList,
Computed: true,
Description: "The access mode for a load balancer with this profile",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Computed: true,
Description: "The type for access mode",
},
"value": {
Type: schema.TypeString,
Computed: true,
Description: "Access modes for this profile",
},
},
},
},
"availability": {
Type: schema.TypeList,
Computed: true,
Description: "The availability mode for a load balancer with this profile",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Computed: true,
Description: "The type of availability, one of [fixed, dependent]",
},
"value": {
Type: schema.TypeString,
Computed: true,
Description: "The availability of this load balancer, one of [subnet, region]. Applicable only if type is fixed",
},
},
},
},
"name": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -49,6 +87,44 @@ func DataSourceIBMISLbProfiles() *schema.Resource {
Computed: true,
Description: "The product family this load balancer profile belongs to",
},
"instance_groups_supported": {
Type: schema.TypeList,
Computed: true,
Description: "The instance groups support for the load balancer with this profile",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Computed: true,
Description: "The type of support for instance groups, one of [fixed, dependent]",
},
"value": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether Instance groups are supported for this profile. Applicable only if type is fixed",
},
},
},
},
"source_ip_session_persistence_supported": {
Type: schema.TypeList,
Computed: true,
Description: "The source IP session ip persistence support for a load balancer with this profile",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Computed: true,
Description: "The type of support for session ip persistence, one of [fixed, dependent on configuration]",
},
"value": {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether session ip persistence are supported for this profile. Applicable only if type is fixed",
},
},
},
},
"route_mode_supported": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -175,6 +251,59 @@ func dataSourceIBMISLbProfilesRead(d *schema.ResourceData, meta interface{}) err
}
}
}

if profileCollector.AccessModes != nil {
accessModes := profileCollector.AccessModes
AccessModesMap := map[string]interface{}{}
AccessModesList := []map[string]interface{}{}
if accessModes.Type != nil {
AccessModesMap["type"] = *accessModes.Type
}
if len(accessModes.Values) > 0 {
AccessModesMap["value"] = accessModes.Values
}
AccessModesList = append(AccessModesList, AccessModesMap)
l[isLBAccessModes] = AccessModesList
}
if profileCollector.Availability != nil {
availabilitySupport := profileCollector.Availability.(*vpcv1.LoadBalancerProfileAvailability)
availabilitySupportMap := map[string]interface{}{}
availabilitySupportList := []map[string]interface{}{}
if availabilitySupport.Type != nil {
availabilitySupportMap["type"] = *availabilitySupport.Type
}
if availabilitySupport.Value != nil {
availabilitySupportMap["value"] = *availabilitySupport.Value
}
availabilitySupportList = append(availabilitySupportList, availabilitySupportMap)
l["availability"] = availabilitySupportList
}
if profileCollector.InstanceGroupsSupported != nil {
instanceGroupSupport := profileCollector.InstanceGroupsSupported.(*vpcv1.LoadBalancerProfileInstanceGroupsSupported)
instanceGroupSupportMap := map[string]interface{}{}
instanceGroupSupportList := []map[string]interface{}{}
if instanceGroupSupport.Type != nil {
instanceGroupSupportMap["type"] = *instanceGroupSupport.Type
}
if instanceGroupSupport.Value != nil {
instanceGroupSupportMap["value"] = *instanceGroupSupport.Value
}
instanceGroupSupportList = append(instanceGroupSupportList, instanceGroupSupportMap)
l["source_ip_session_persistence_supported"] = instanceGroupSupportList
}
if profileCollector.SourceIPSessionPersistenceSupported != nil {
sourceIpPersistenceSupport := profileCollector.SourceIPSessionPersistenceSupported.(*vpcv1.LoadBalancerProfileSourceIPSessionPersistenceSupported)
sourceIpPersistenceSupportMap := map[string]interface{}{}
sourceIpPersistenceSupportList := []map[string]interface{}{}
if sourceIpPersistenceSupport.Type != nil {
sourceIpPersistenceSupportMap["type"] = *sourceIpPersistenceSupport.Type
}
if sourceIpPersistenceSupport.Value != nil {
sourceIpPersistenceSupportMap["value"] = *sourceIpPersistenceSupport.Value
}
sourceIpPersistenceSupportList = append(sourceIpPersistenceSupportList, sourceIpPersistenceSupportMap)
l["instance_groups_supported"] = sourceIpPersistenceSupportList
}
lbprofilesInfo = append(lbprofilesInfo, l)
}
d.SetId(dataSourceIBMISLbProfilesID(d))
Expand Down
3 changes: 3 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_lb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func TestAccIBMISLBDatasource_basic(t *testing.T) {
"data.ibm_is_lb.ds_lb", "name", name),
resource.TestCheckResourceAttr(
"data.ibm_is_lb.ds_lb", "route_mode", routeMode),
resource.TestCheckResourceAttrSet("data.ibm_is_lb.ds_lb", "availability"),
resource.TestCheckResourceAttrSet("data.ibm_is_lb.ds_lb", "instance_groups_supported"),
resource.TestCheckResourceAttrSet("data.ibm_is_lb.ds_lb", "source_ip_persistence_supported"),
),
},
},
Expand Down
36 changes: 35 additions & 1 deletion ibm/service/vpc/data_source_ibm_is_lbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func DataSourceIBMISLBS() *schema.Resource {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
isLBAccessMode: {
Type: schema.TypeString,
Computed: true,
Description: "The access mode of this load balancer",
},
ID: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -75,6 +80,21 @@ func DataSourceIBMISLBS() *schema.Resource {
Computed: true,
Description: "Load Balancer name",
},
isLBAvailability: {
Type: schema.TypeString,
Computed: true,
Description: "The availability of this load balancer",
},
isLBInstanceGroupsSupported: {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this load balancer supports instance groups.",
},
isLBSourceIPPersistenceSupported: {
Type: schema.TypeBool,
Computed: true,
Description: "Indicates whether this load balancer supports source IP session persistence.",
},
isLBUdpSupported: {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -321,6 +341,18 @@ func getLbs(d *schema.ResourceData, meta interface{}) error {
lbInfo := make(map[string]interface{})
// log.Printf("******* lb ******** : (%+v)", lb)
lbInfo[ID] = *lb.ID
if lb.Availability != nil {
lbInfo[isLBAvailability] = *lb.Availability
}
if lb.AccessMode != nil {
lbInfo[isLBAccessMode] = *lb.AccessMode
}
if lb.InstanceGroupsSupported != nil {
lbInfo[isLBInstanceGroupsSupported] = *lb.InstanceGroupsSupported
}
if lb.SourceIPSessionPersistenceSupported != nil {
lbInfo[isLBSourceIPPersistenceSupported] = *lb.SourceIPSessionPersistenceSupported
}
lbInfo[isLBName] = *lb.Name
dnsList := make([]map[string]interface{}, 0)
if lb.Dns != nil {
Expand All @@ -342,6 +374,8 @@ func getLbs(d *schema.ResourceData, meta interface{}) error {
lbInfo[CreatedAt] = lb.CreatedAt.String()
if *lb.IsPublic {
lbInfo[isLBType] = "public"
} else if *lb.IsPrivatePath {
lbInfo[isLBType] = "private_path"
} else {
lbInfo[isLBType] = "private"
}
Expand Down Expand Up @@ -437,7 +471,7 @@ func getLbs(d *schema.ResourceData, meta interface{}) error {
lbProfile := make(map[string]interface{})
lbProfile[name] = *lb.Profile.Name
lbProfile[href] = *lb.Profile.Href
lbProfile["family"] = *lb.Profile.Family
lbProfile[family] = *lb.Profile.Family
lbInfo[isLbProfile] = lbProfile
}
lbInfo[isLBResourceGroup] = *lb.ResourceGroup.ID
Expand Down
Loading
Loading