Skip to content
Draft
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.75.0
github.com/IBM/vpc-go-sdk v0.76.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 @@ -168,10 +168,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.74.1 h1:qkWwdlILx3ZVNWht96CdlPKwhKL/y3ItN6XmwJ1rShM=
github.com/IBM/vpc-go-sdk v0.74.1/go.mod h1:8lX6TpeYBbx1Vd4KTgM3PPQ4y3auGOPuD6qq3UBDdug=
github.com/IBM/vpc-go-sdk v0.75.0 h1:8s11vR30n0eY9ptf6Osh9Bw13okhMVasb/KX9M52LEg=
github.com/IBM/vpc-go-sdk v0.75.0/go.mod h1:8lX6TpeYBbx1Vd4KTgM3PPQ4y3auGOPuD6qq3UBDdug=
github.com/IBM/vpc-go-sdk v0.76.0 h1:iuiUaGPs9ngfMZ4HkT9fVz/GX/03S2vB9BZ7Rgj+/4U=
github.com/IBM/vpc-go-sdk v0.76.0/go.mod h1:8lX6TpeYBbx1Vd4KTgM3PPQ4y3auGOPuD6qq3UBDdug=
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
20 changes: 20 additions & 0 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ var (
trustedMachineType string
)

// For VPC Endpoint Gateway
var (
IsResourceBindingCRN string
IsEndpointGatewayTargetCRN string
IsEndpointGatewayTargetType string
)

// MQ on Cloud
var (
MqcloudConfigEndpoint string
Expand Down Expand Up @@ -809,6 +816,19 @@ func init() {
fmt.Println("[INFO] Set the environment variable SL_REGION for testing ibm_is_region datasource else it is set to default value 'us-south'")
}

IsResourceBindingCRN = os.Getenv("IBM_IS_RESOURCE_BINDING_CRN")
if IsResourceBindingCRN == "" {
fmt.Println("[WARN] Set the environment variable IBM_IS_RESOURCE_BINDING_CRN for testing IBM VPC Endpoint gateway resources, the tests will fail if this is not set")
}
IsEndpointGatewayTargetCRN = os.Getenv("IBM_IS_ENDPOINT_BINDING_TARGET_CRN")
if IsEndpointGatewayTargetCRN == "" {
fmt.Println("[WARN] Set the environment variable IBM_IS_ENDPOINT_BINDING_TARGET_CRN for testing IBM VPC Endpoint gateway resources, the tests will fail if this is not set")
}
IsEndpointGatewayTargetType = os.Getenv("IBM_IS_ENDPOINT_BINDING_TARGET_TYPE")
if IsEndpointGatewayTargetType == "" {
fmt.Println("[WARN] Set the environment variable IBM_IS_ENDPOINT_BINDING_TARGET_TYPE for testing IBM VPC Endpoint gateway resources, the tests will fail if this is not set")
}

ISZoneName = os.Getenv("SL_ZONE")
if ISZoneName == "" {
ISZoneName = "us-south-1"
Expand Down
36 changes: 21 additions & 15 deletions ibm/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,21 +539,25 @@ func Provider() *schema.Provider {
"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(),
// vpe resource bindings
"ibm_is_virtual_endpoint_gateway_resource_binding": vpc.DataSourceIBMIsVirtualEndpointGatewayResourceBinding(),
"ibm_is_virtual_endpoint_gateway_resource_bindings": vpc.DataSourceIBMIsVirtualEndpointGatewayResourceBindings(),

"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 @@ -1367,6 +1371,7 @@ func Provider() *schema.Provider {
"ibm_is_instance_group_manager_policy": vpc.ResourceIBMISInstanceGroupManagerPolicy(),
"ibm_is_instance_group_manager_action": vpc.ResourceIBMISInstanceGroupManagerAction(),
"ibm_is_instance_volume_attachment": vpc.ResourceIBMISInstanceVolumeAttachment(),
"ibm_is_virtual_endpoint_gateway_resource_binding": vpc.ResourceIBMIsVirtualEndpointGatewayResourceBinding(),
"ibm_is_virtual_endpoint_gateway": vpc.ResourceIBMISEndpointGateway(),
"ibm_is_virtual_endpoint_gateway_ip": vpc.ResourceIBMISEndpointGatewayIP(),
"ibm_is_instance_template": vpc.ResourceIBMISInstanceTemplate(),
Expand Down Expand Up @@ -2161,6 +2166,7 @@ func Validator() validate.ValidatorDict {
"ibm_schematics_policy": schematics.ResourceIbmSchematicsPolicyValidator(),
"ibm_resource_instance": resourcecontroller.ResourceIBMResourceInstanceValidator(),
"ibm_resource_key": resourcecontroller.ResourceIBMResourceKeyValidator(),
"ibm_is_virtual_endpoint_gateway_resource_binding": vpc.ResourceIBMIsVirtualEndpointGatewayResourceBindingValidator(),
"ibm_is_virtual_endpoint_gateway": vpc.ResourceIBMISEndpointGatewayValidator(),
"ibm_resource_tag": globaltagging.ResourceIBMResourceTagValidator(),
"ibm_iam_access_tag": globaltagging.ResourceIBMIamAccessTagValidator(),
Expand Down
34 changes: 33 additions & 1 deletion ibm/service/vpc/data_source_ibm_is_virtual_endpoint_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ func DataSourceIBMISEndpointGateway() *schema.Resource {
isVirtualEndpointGatewayAllowDnsResolutionBinding: {
Type: schema.TypeBool,
Computed: true,
Deprecated: "This property has been deprecated in favor of dns_resolution_binding_mode.",
Description: "Indicates whether to allow this endpoint gateway to participate in DNS resolution bindings with a VPC that has dns.enable_hub set to true.",
},
"dns_resolution_binding_mode": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "The DNS resolution binding mode used for this endpoint gateway:- `disabled`: The endpoint gateway is not participating in [DNS sharing for VPE gateways](/docs/vpc?topic=vpc-vpe-dns-sharing).- `primary`: The endpoint gateway is participating in [DNS sharing for VPE gateways] (/docs/vpc?topic=vpc-vpe-dns-sharing) if the VPC this endpoint gateway resides in has a DNS resolution binding to another VPC.- `per_resource_binding`: The endpoint gateway is participating in [DNS sharing for VPE gateways](/docs/vpc?topic=vpc-vpe-dns-sharing) if the VPC this endpoint gateway resides in has a DNS resolution binding to another VPC, and resource binding is enabled for the `target` service.",
},
isVirtualEndpointGatewayIPs: {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -209,7 +215,20 @@ func dataSourceIBMISEndpointGatewayRead(
result := allrecs[0]
d.SetId(*result.ID)
d.Set(isVirtualEndpointGatewayName, result.Name)
d.Set(isVirtualEndpointGatewayAllowDnsResolutionBinding, result.AllowDnsResolutionBinding)
// Handle the new dns_resolution_binding_mode field
// Handle the new dns_resolution_binding_mode field (API now only returns this field)
if result.DnsResolutionBindingMode != nil && *result.DnsResolutionBindingMode != "" {
if err = d.Set("dns_resolution_binding_mode", *result.DnsResolutionBindingMode); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting dns_resolution_binding_mode: %s", err), "(Data) ibm_is_virtual_endpoint_gateway", "read", "set-dns_resolution_binding_mode").GetDiag()
}

// Compute and set deprecated field for backward compatibility in Terraform state
allowDnsResolutionBinding := mapDnsResolutionBindingModeToBoolean(*result.DnsResolutionBindingMode)
if err = d.Set(isVirtualEndpointGatewayAllowDnsResolutionBinding, allowDnsResolutionBinding); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting allow_dns_resolution_binding: %s", err), "(Data) ibm_is_virtual_endpoint_gateway", "read", "set-allow_dns_resolution_binding").GetDiag()
}
}

d.Set(isVirtualEndpointGatewayCRN, result.CRN)
d.Set(isVirtualEndpointGatewayHealthState, result.HealthState)
d.Set(isVirtualEndpointGatewayCreatedAt, result.CreatedAt.String())
Expand Down Expand Up @@ -243,3 +262,16 @@ func dataSourceIBMISEndpointGatewayRead(
}
return nil
}

// Helper functions for field mapping during migration period
func mapDnsResolutionBindingModeToBoolean(mode string) bool {
switch mode {
case "disabled":
return false
case "primary", "per_resource_binding":
return true
default:
// Default to false for unknown values
return false
}
}
Loading
Loading