diff --git a/go.mod b/go.mod index 4c06cd1d1d..55322cd7a7 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc - github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c + github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 github.com/IBM-Cloud/power-go-client v1.5.4 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 diff --git a/go.sum b/go.sum index e9de9e3543..30e5ffdf8e 100644 --- a/go.sum +++ b/go.sum @@ -104,6 +104,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc h1:AeooCa6UMW github.com/IBM-Cloud/bluemix-go v0.0.0-20231204080125-462fa9e436bc/go.mod h1:jIGLnIfj+uBv2ALz3rVHzNbNwt0V/bEWNeJKECa8Q+k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c h1:tRS4VuOG3lHNG+yrsh3vZZQDVNLuFJB0oZbTJp9YXds= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= +github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6 h1:QXU1Atl/JSI3ZtYB9tHbWLhrFYE1E+5Iww1sjQ7mqdo= +github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231116055201-2a84da7b9bd6/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= github.com/IBM-Cloud/power-go-client v1.5.4 h1:fk+QgOdZvwq696UynehfGrMGMHXDYOJfRCE3Pec9o6c= github.com/IBM-Cloud/power-go-client v1.5.4/go.mod h1:ZsKqKC4d4MAWujkttW1w9tG7xjlIbkIpVENX476ghVY= diff --git a/ibm/service/satellite/data_source_ibm_satellite_host_script.go b/ibm/service/satellite/data_source_ibm_satellite_host_script.go index 069f1f60e5..48ac821502 100644 --- a/ibm/service/satellite/data_source_ibm_satellite_host_script.go +++ b/ibm/service/satellite/data_source_ibm_satellite_host_script.go @@ -74,6 +74,11 @@ func DataSourceIBMSatelliteAttachHostScript() *schema.Resource { Optional: true, ExactlyOneOf: []string{"host_provider", "custom_script"}, }, + "host_link_agent_endpoint": { + Description: "The satellite link agent endpoint, required for reduced firewall attach script", + Type: schema.TypeString, + Optional: true, + }, }, } } @@ -155,6 +160,12 @@ func dataSourceIBMSatelliteAttachHostScriptRead(d *schema.ResourceData, meta int scriptPath = filepath.Join(scriptDir, "addHost.sh") } + // If the user supplied link agent endpoint, use reduced firewall attach script + if hlae, ok := d.GetOk("host_link_agent_endpoint"); ok { + host_link_agent_endpoint := hlae.(string) + createRegOptions.HostLinkAgentEndpoint = &host_link_agent_endpoint + } + resp, err := satClient.AttachSatelliteHost(createRegOptions) if err != nil { return fmt.Errorf("[ERROR] Error Generating Satellite Registration Script: %s\n%s", err, resp) diff --git a/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go b/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go index 6d3a98709f..9c09d5a5a8 100644 --- a/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go +++ b/ibm/service/satellite/data_source_ibm_satellite_host_script_test.go @@ -55,6 +55,7 @@ func TestAccIBMSatelliteAttachHostScriptDataSourceBasicCoreos(t *testing.T) { Config: testAccCheckIBMSatelliteAttachHostScriptDataSourceConfigCoreos(locationName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ibm_satellite_attach_host_script.script", "host_provider", "ibm"), + resource.TestCheckResourceAttr("data.ibm_satellite_attach_host_script.script", "host_link_agent_endpoint", "testendpoint"), ), }, }, @@ -75,5 +76,6 @@ data "ibm_satellite_attach_host_script" "script" { labels = ["env:prod"] coreos_host = true host_provider = "ibm" + host_link_agent_endpoint = "testendpoint" }`, locationName) } diff --git a/website/docs/d/satellite_attach_host_script.html.markdown b/website/docs/d/satellite_attach_host_script.html.markdown index 824f177ec9..e578670ec5 100644 --- a/website/docs/d/satellite_attach_host_script.html.markdown +++ b/website/docs/d/satellite_attach_host_script.html.markdown @@ -21,14 +21,15 @@ data "ibm_satellite_attach_host_script" "script" { } ``` -### Sample to read satellite host script to attach AWS EC2 host to Satellite control plane +### Sample to read satellite host script to attach AWS EC2 host to Satellite control plane and uses reduced firewall requirements. ```terraform data "ibm_satellite_attach_host_script" "script" { - location = var.location - labels = var.labels - script_dir = "/tmp" - host_provider = "aws" + location = var.location + labels = var.labels + script_dir = "/tmp" + host_provider = "aws" + host_link_agent_endpoint = "c-01-ws.us-south.link.satellite.cloud.ibm.com" } ``` ### Sample to read satellite host script to attach IBM host to Satellite control plane @@ -38,11 +39,11 @@ data "ibm_satellite_attach_host_script" "script" { location = var.location custom_script = <