diff --git a/internal/services/automation/automation_software_update_configuration_resource.go b/internal/services/automation/automation_software_update_configuration_resource.go index 7f1593b82c6b..9d98a526ce3e 100644 --- a/internal/services/automation/automation_software_update_configuration_resource.go +++ b/internal/services/automation/automation_software_update_configuration_resource.go @@ -86,7 +86,9 @@ func updateTaskFromSDK(prop *softwareupdateconfiguration.TaskProperties) (res [] res = append(res, UpdateTask{ Source: utils.NormalizeNilableString(prop.Source), }) + if prop.Parameters != nil { + res[0].Parameters = map[string]string{} for k, v := range *prop.Parameters { res[0].Parameters[k] = v } diff --git a/internal/services/automation/automation_software_update_configuration_resource_test.go b/internal/services/automation/automation_software_update_configuration_resource_test.go index 7b72f6b800d7..0811fff756e0 100644 --- a/internal/services/automation/automation_software_update_configuration_resource_test.go +++ b/internal/services/automation/automation_software_update_configuration_resource_test.go @@ -58,6 +58,21 @@ func TestAccSoftwareUpdateConfiguration_basic(t *testing.T) { }) } +func TestAccSoftwareUpdateConfiguration_withTask(t *testing.T) { + data := acceptance.BuildTestData(t, automation.SoftwareUpdateConfigurationResource{}.ResourceType(), "test") + r := newSoftwareUpdateConfigurationResource() + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withTask(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + // scheduleInfo.advancedSchedule always return null + data.ImportStep("schedule.0.advanced", "schedule.0.monthly_occurrence"), + }) +} + func TestAccSoftwareUpdateConfiguration_defaultTimeZone(t *testing.T) { data := acceptance.BuildTestData(t, automation.SoftwareUpdateConfigurationResource{}.ResourceType(), "test") r := newSoftwareUpdateConfigurationResource() @@ -224,6 +239,93 @@ resource "azurerm_automation_software_update_configuration" "test" { `, a.template(data), data.RandomInteger, a.startTime, a.expireTime) } +func (a SoftwareUpdateConfigurationResource) withTask(data acceptance.TestData) string { + return fmt.Sprintf(` + + +resource "azurerm_automation_runbook" "test" { + name = "Get-AzureVMTutorial" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + automation_account_name = azurerm_automation_account.test.name + + log_verbose = "true" + log_progress = "true" + description = "This is a test runbook for terraform acceptance test" + runbook_type = "PowerShell" + + content = <