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

azurerm_data_factory_integration_runtime_azure_ssis - support for the copy_compute_scale, pipeline_external_compute_scale properties #25281

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ 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.

* `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.
Expand All @@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `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.
* `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.
Expand Down Expand Up @@ -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.
Comment on lines +188 to +190
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `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.
* `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.
Expand Down
Loading