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_automation_software_update_configuration - Refactor and add correct API constraints. #22204

Merged
merged 8 commits into from Jun 29, 2023

Conversation

jackofallops
Copy link
Member

Adds schema validation and restrictions based on API limits / requirements:

  • operating_system has been deprecated and is now controlled by the presence of either a linux or windows block.
  • One of linux or windows block must now be present. This is a requirement of the API, so is a non-breaking Optional to Required change.
  • monthly_occurrence - blocks limited to 1 due to:
Failure responding to request: StatusCode=400 -- Original Error:
        autorest/azure: Service returned an error. Status=400 Code="BadRequest"
        Message="{\"Message\":\"The request is
        invalid.\",\"ModelState\":{\"softwareUpdateConfiguration.properties.scheduleInfo.advancedSchedule.monthlyOccurrences\":[\"More
        than one Monthly Occurrence is not supported\"]}}"
  • duration now defaults to PT2H as per the service.
  • schedule block is now limited to 1, to match the API limit.
  • schedule block is now Required to match the API specification. The API rejects requests that do not specify this block, with at least a frequency value.
  • frequency is now a Required property of the schedule block. This is to match the minimum requirements of the API.
  • pre_task blocks are now limited to 1 to match the API
  • post_task blocks are now limited to 1 to match the API

closes #21970

autorest/azure: Service returned an error. Status=400 Code="BadRequest"
Message="{\"Message\":\"The request is
invalid.\",\"ModelState\":{\"softwareUpdateConfiguration.properties.scheduleInfo.advancedSchedule.monthlyOccurrences\":[\"More
than one Monthly Occurrence is not supported\"]}}"
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

LGTM aside from one comment ☁️

@jackofallops jackofallops merged commit e47e623 into main Jun 29, 2023
13 checks passed
@jackofallops jackofallops deleted the r/refactor-automation-software-update-config branch June 29, 2023 08:17
@github-actions github-actions bot added this to the v3.63.0 milestone Jun 29, 2023
jackofallops added a commit that referenced this pull request Jun 29, 2023
@@ -451,7 +623,7 @@ provider "azurerm" {

resource "azurerm_resource_group" "test" {
name = "acctestRG-auto-%[1]d"
location = "West US"
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a random location will cause test failure, because the required log analytics workspace location is not the same as the automation account's location in EastUS and EastUS2.

image

Error as below;

Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Error - chosen Azure Automation does not have a Log Analytics workspace linked for operation to succeed. To know which regions are supported for linking, see our documentation at: https://aka.ms/Automation-Region-Mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_automation_software_update_configuration | monthly_occurance issue
3 participants