From 1114e601a9fc0ced6d8eff3806e5216239e0763b Mon Sep 17 00:00:00 2001 From: Heng Lu Date: Mon, 18 Mar 2024 13:34:18 +0800 Subject: [PATCH] `azurerm_data_factory_integration_runtime_azure_ssis` - support for the `copy_compute_scale`, `pipeline_external_compute_scale` properties --- ...integration_runtime_azure_ssis_resource.go | 123 ++++++++++++++++++ ...ration_runtime_azure_ssis_resource_test.go | 81 ++++++++++++ ...tegration_runtime_azure_ssis.html.markdown | 24 +++- 3 files changed, 227 insertions(+), 1 deletion(-) diff --git a/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go b/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go index 9f81b2ec5402..0134feb10872 100644 --- a/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go +++ b/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go @@ -8,6 +8,7 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/datafactory/2018-06-01/factories" @@ -123,6 +124,30 @@ func resourceDataFactoryIntegrationRuntimeAzureSsis() *pluginsdk.Resource { }, false), }, + "copy_compute_scale": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "data_integration_unit": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.All( + validation.IntBetween(4, 256), + validation.IntDivisibleBy(4), + ), + }, + + "time_to_live": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(5), + }, + }, + }, + }, + "express_vnet_integration": { Type: pluginsdk.TypeList, Optional: true, @@ -423,6 +448,33 @@ func resourceDataFactoryIntegrationRuntimeAzureSsis() *pluginsdk.Resource { }, }, + "pipeline_external_compute_scale": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "number_of_external_nodes": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 10), + }, + + "number_of_pipeline_nodes": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 10), + }, + + "time_to_live": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(5), + }, + }, + }, + }, + "proxy": { Type: pluginsdk.TypeList, Optional: true, @@ -560,6 +612,14 @@ func resourceDataFactoryIntegrationRuntimeAzureSsisRead(d *pluginsdk.ResourceDat if err := d.Set("vnet_integration", flattenDataFactoryIntegrationRuntimeAzureSsisVnetIntegration(computeProps.VNetProperties)); err != nil { return fmt.Errorf("setting `vnet_integration`: %+v", err) } + + if err := d.Set("copy_compute_scale", flattenDataFactoryIntegrationRuntimeAzureSsisCopyComputeScale(computeProps.CopyComputeScaleProperties)); err != nil { + return fmt.Errorf("setting `copy_compute_scale`: %+v", err) + } + + if err := d.Set("pipeline_external_compute_scale", flattenDataFactoryIntegrationRuntimeAzureSsisPipelineExternalComputeScaleProperties(computeProps.PipelineExternalComputeScaleProperties)); err != nil { + return fmt.Errorf("setting `pipeline_external_compute_scale`: %+v", err) + } } if ssisProps := managedIntegrationRuntime.SsisProperties; ssisProps != nil { @@ -646,6 +706,44 @@ func expandDataFactoryIntegrationRuntimeAzureSsisComputeProperties(d *pluginsdk. } } + if copyComputeScales, ok := d.GetOk("copy_compute_scale"); ok && len(copyComputeScales.([]interface{})) > 0 { + copyComputeScale := copyComputeScales.([]interface{})[0].(map[string]interface{}) + if v := copyComputeScale["data_integration_unit"].(int); v != 0 { + if computeProperties.CopyComputeScaleProperties == nil { + computeProperties.CopyComputeScaleProperties = &datafactory.CopyComputeScaleProperties{} + } + computeProperties.CopyComputeScaleProperties.DataIntegrationUnit = pointer.To(int32(copyComputeScale["data_integration_unit"].(int))) + } + if v := copyComputeScale["time_to_live"].(int); v != 0 { + if computeProperties.CopyComputeScaleProperties == nil { + computeProperties.CopyComputeScaleProperties = &datafactory.CopyComputeScaleProperties{} + } + computeProperties.CopyComputeScaleProperties.TimeToLive = pointer.To(int32(copyComputeScale["time_to_live"].(int))) + } + } + + if pipelineExternalComputeScales, ok := d.GetOk("pipeline_external_compute_scale"); ok && len(pipelineExternalComputeScales.([]interface{})) > 0 { + pipelineExternalComputeScale := pipelineExternalComputeScales.([]interface{})[0].(map[string]interface{}) + if v := pipelineExternalComputeScale["number_of_external_nodes"].(int); v != 0 { + if computeProperties.PipelineExternalComputeScaleProperties == nil { + computeProperties.PipelineExternalComputeScaleProperties = &datafactory.PipelineExternalComputeScaleProperties{} + } + computeProperties.PipelineExternalComputeScaleProperties.NumberOfExternalNodes = pointer.To(int32(pipelineExternalComputeScale["number_of_external_nodes"].(int))) + } + if v := pipelineExternalComputeScale["number_of_pipeline_nodes"].(int); v != 0 { + if computeProperties.PipelineExternalComputeScaleProperties == nil { + computeProperties.PipelineExternalComputeScaleProperties = &datafactory.PipelineExternalComputeScaleProperties{} + } + computeProperties.PipelineExternalComputeScaleProperties.NumberOfPipelineNodes = pointer.To(int32(pipelineExternalComputeScale["number_of_pipeline_nodes"].(int))) + } + if v := pipelineExternalComputeScale["time_to_live"].(int); v != 0 { + if computeProperties.PipelineExternalComputeScaleProperties == nil { + computeProperties.PipelineExternalComputeScaleProperties = &datafactory.PipelineExternalComputeScaleProperties{} + } + computeProperties.PipelineExternalComputeScaleProperties.TimeToLive = pointer.To(int32(pipelineExternalComputeScale["time_to_live"].(int))) + } + } + return &computeProperties } @@ -1145,6 +1243,31 @@ func flattenDataFactoryIntegrationRuntimeCustomerVnetIntegration(input *datafact } } +func flattenDataFactoryIntegrationRuntimeAzureSsisPipelineExternalComputeScaleProperties(input *datafactory.PipelineExternalComputeScaleProperties) []interface{} { + if input == nil { + return []interface{}{} + } + return []interface{}{ + map[string]interface{}{ + "number_of_external_nodes": pointer.From(input.NumberOfPipelineNodes), + "number_of_pipeline_nodes": pointer.From(input.NumberOfPipelineNodes), + "time_to_live": pointer.From(input.TimeToLive), + }, + } +} + +func flattenDataFactoryIntegrationRuntimeAzureSsisCopyComputeScale(input *datafactory.CopyComputeScaleProperties) []interface{} { + if input == nil { + return []interface{}{} + } + return []interface{}{ + map[string]interface{}{ + "data_integration_unit": pointer.From(input.DataIntegrationUnit), + "time_to_live": pointer.From(input.TimeToLive), + }, + } +} + func readBackSensitiveValue(input []interface{}, propertyName string, filters map[string]string) string { if len(input) == 0 { return "" diff --git a/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource_test.go b/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource_test.go index 4a0192847678..001cc541138c 100644 --- a/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource_test.go +++ b/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource_test.go @@ -195,6 +195,50 @@ func TestAccDataFactoryIntegrationRuntimeManagedSsis_withElasticPool(t *testing. }) } +func TestAccDataFactoryIntegrationRuntimeManagedSsis_computeScale(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_data_factory_integration_runtime_azure_ssis", "test") + r := IntegrationRuntimeManagedSsisResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.computeScale(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDataFactoryIntegrationRuntimeManagedSsis_computeScaleUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_data_factory_integration_runtime_azure_ssis", "test") + r := IntegrationRuntimeManagedSsisResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.computeScale(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (IntegrationRuntimeManagedSsisResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -929,6 +973,43 @@ resource "azurerm_data_factory_integration_runtime_azure_ssis" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) } +func (IntegrationRuntimeManagedSsisResource) computeScale(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-df-%[2]d" + location = "%[1]s" +} + +resource "azurerm_data_factory" "test" { + name = "acctestdfirm%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_data_factory_integration_runtime_azure_ssis" "test" { + name = "acctestir%[2]d" + data_factory_id = azurerm_data_factory.test.id + location = azurerm_resource_group.test.location + node_size = "Standard_D8_v3" + + copy_compute_scale { + data_integration_unit = 8 + time_to_live = 6 + } + + pipeline_external_compute_scale { + number_of_external_nodes = 6 + number_of_pipeline_nodes = 6 + time_to_live = 8 + } +} +`, data.Locations.Primary, data.RandomInteger) +} + func (t IntegrationRuntimeManagedSsisResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.IntegrationRuntimeID(state.ID) if err != nil { diff --git a/website/docs/r/data_factory_integration_runtime_azure_ssis.html.markdown b/website/docs/r/data_factory_integration_runtime_azure_ssis.html.markdown index 2ef869d732a4..814548db5dbf 100644 --- a/website/docs/r/data_factory_integration_runtime_azure_ssis.html.markdown +++ b/website/docs/r/data_factory_integration_runtime_azure_ssis.html.markdown @@ -59,6 +59,8 @@ The following arguments are supported: * `catalog_info` - (Optional) A `catalog_info` block as defined below. +* `copy_compute_scale` - (Optional) One `copy_compute_scale` block as defined below. + * `custom_setup_script` - (Optional) A `custom_setup_script` block as defined below. * `express_custom_setup` - (Optional) An `express_custom_setup` block as defined below. @@ -66,7 +68,9 @@ The following arguments are supported: * `express_vnet_integration` - (Optional) A `express_vnet_integration` block as defined below. * `package_store` - (Optional) One or more `package_store` block as defined below. - + +* `pipeline_external_compute_scale` - (Optional) One `pipeline_external_compute_scale` block as defined below. + * `proxy` - (Optional) A `proxy` block as defined below. * `vnet_integration` - (Optional) A `vnet_integration` block as defined below. @@ -91,6 +95,14 @@ A `catalog_info` block supports the following: --- +A `copy_compute_scale` block supports the following: + +* `data_integration_unit` - (Optional) Specifies the data integration unit number setting reserved for copy activity execution. Supported values are multiples of 4 in range 4-256. + +* `time_to_live` - (Optional) Specifies the time to live (in minutes) setting of integration runtime which will execute copy activity. Possible values are at least `5`. + +--- + A `custom_setup_script` block supports the following: * `blob_container_uri` - (Required) The blob endpoint for the container which contains a custom setup script that will be run on every node on startup. See [https://docs.microsoft.com/azure/data-factory/how-to-configure-azure-ssis-ir-custom-setup](https://docs.microsoft.com/azure/data-factory/how-to-configure-azure-ssis-ir-custom-setup) for more information. @@ -171,6 +183,16 @@ A `proxy` block supports the following: --- +A `pipeline_external_compute_scale` block supports the following: + +* `number_of_external_nodes` - (Optional) Specifies the number of the external nodes, which should be greater than 0 and less than 11. + +* `number_of_pipeline_nodes` - (Optional) Specifies the number of the pipeline nodes, which should be greater than 0 and less than 11. + +* `time_to_live` - (Optional) Specifies the time to live (in minutes) setting of integration runtime which will execute copy activity. Possible values are at least `5`. + +--- + A `vnet_integration` block supports the following: * `vnet_id` - (Optional) ID of the virtual network to which the nodes of the Azure-SSIS Integration Runtime will be added.