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

New Resource: azurerm_automation_powershell72_module #23980

Merged
merged 11 commits into from
Jan 4, 2024

Conversation

aristosvo
Copy link
Collaborator

@aristosvo aristosvo commented Nov 21, 2023

Done

Fixes #24252

@aristosvo aristosvo force-pushed the automation/powershell72 branch from f206275 to 8e2ccce Compare November 21, 2023 19:02
@aristosvo aristosvo force-pushed the automation/powershell72 branch from 452c8f5 to e2ff7ff Compare November 24, 2023 19:43
@aristosvo aristosvo changed the title azurerm_automation_*: Enable PowerShell 7.2 modules [WIP] azurerm_automation_*: Enable PowerShell 7.2 modules Nov 24, 2023
@aristosvo aristosvo marked this pull request as ready for review November 24, 2023 19:44
Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks for this new resource @aristosvo.

Unfortunately since this would need to be re-written into a typed resource in the coming months due to the changes we need to make within the provider to support framework.

Since you have experience writing typed resources would you mind converting this to a typed resource now? It would help us out a lot!

@aristosvo
Copy link
Collaborator Author

aristosvo commented Dec 4, 2023

Hi @stephybun! Thanks for the feedback.

I wouldn't mind, can you clarify if that would include rewriting to use a tfschema structure like used for webapps? Or just as shown in the contributing guide?

@stephybun
Copy link
Member

@aristosvo typed resources should always have a tfschema defined. We need to update the docs to reflect that, thanks for pointing that out!

@aristosvo
Copy link
Collaborator Author

@stephybun A lot of the resources in the provider just return nil to the ModelObject(). Should these resources then be enhanced as well, is that some sort of an intermediate step?

@stephybun
Copy link
Member

@aristosvo yes, ultimately resources that are doing this will need to be updated to define and return a tfschema model.

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks for rewriting this @aristosvo! I've made a first pass through and it's looking mostly fine. If you can take a look at the couple of comments left in-line, then we can take another look through.

// for existing global module do update instead of raising ImportAsExistsError
isGlobal := existing.Model != nil && existing.Model.Properties != nil && existing.Model.Properties.IsGlobal != nil && *existing.Model.Properties.IsGlobal
if !response.WasNotFound(existing.HttpResponse) && !isGlobal {
return tf.ImportAsExistsError("azurerm_automation_powershell72_module", id.ID())
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not that familiar with the automation service, but this seems like it could be problematic if the global module was created by and is being managed by terraform? Could you elaborate some more on this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually I didn't know exactly what the functionality is we are supporting here, but it was an feature request on azurerm_automation_module which seems to make sense to also have in azurerm_automation_powershell72_module: #18198

internal/services/automation/registration.go Outdated Show resolved Hide resolved
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.

Seem to have some test failures:

------- Stdout: -------
=== RUN   TestAccAutomationPowerShell72Module_complete
=== PAUSE TestAccAutomationPowerShell72Module_complete
=== CONT  TestAccAutomationPowerShell72Module_complete
    testcase.go:113: Step 1/2 error: Error running pre-apply refresh: exit status 1
        
        Error: Missing required argument
        
          on terraform_plugin_test.tf line 33, in resource "azurerm_automation_powershell72_module" "test":
          33: resource "azurerm_automation_powershell72_module" "test" {
        
        The argument "automation_account_id" is required, but no definition was
        found.
        
        Error: Unsupported argument
        
          on terraform_plugin_test.tf line 35, in resource "azurerm_automation_powershell72_module" "test":
          35:   resource_group_name     = azurerm_resource_group.test.name
        
        An argument named "resource_group_name" is not expected here.
        
        Error: Unsupported argument
        
          on terraform_plugin_test.tf line 36, in resource "azurerm_automation_powershell72_module" "test":
          36:   automation_account_name = azurerm_automation_account.test.name
        
        An argument named "automation_account_name" is not expected here.
--- FAIL: TestAccAutomationPowerShell72Module_complete (15.50s)
FAIL

@aristosvo aristosvo force-pushed the automation/powershell72 branch from 5018c17 to 820210e Compare December 28, 2023 13:27
@aristosvo
Copy link
Collaborator Author

Seem to have some test failures:

------- Stdout: -------
=== RUN   TestAccAutomationPowerShell72Module_complete
=== PAUSE TestAccAutomationPowerShell72Module_complete
=== CONT  TestAccAutomationPowerShell72Module_complete
    testcase.go:113: Step 1/2 error: Error running pre-apply refresh: exit status 1
        
        Error: Missing required argument
        
          on terraform_plugin_test.tf line 33, in resource "azurerm_automation_powershell72_module" "test":
          33: resource "azurerm_automation_powershell72_module" "test" {
        
        The argument "automation_account_id" is required, but no definition was
        found.
        
        Error: Unsupported argument
        
          on terraform_plugin_test.tf line 35, in resource "azurerm_automation_powershell72_module" "test":
          35:   resource_group_name     = azurerm_resource_group.test.name
        
        An argument named "resource_group_name" is not expected here.
        
        Error: Unsupported argument
        
          on terraform_plugin_test.tf line 36, in resource "azurerm_automation_powershell72_module" "test":
          36:   automation_account_name = azurerm_automation_account.test.name
        
        An argument named "automation_account_name" is not expected here.
--- FAIL: TestAccAutomationPowerShell72Module_complete (15.50s)
FAIL

@katbyte Tests are fixed!

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 🚜

@katbyte katbyte merged commit bf93c82 into hashicorp:main Jan 4, 2024
33 checks passed
@katbyte katbyte changed the title azurerm_automation_*: Enable PowerShell 7.2 modules New Resource: azurerm_automation_powershell72_module Jan 4, 2024
@github-actions github-actions bot added this to the v3.86.0 milestone Jan 4, 2024
katbyte added a commit that referenced this pull request Jan 4, 2024
dduportal pushed a commit to jenkins-infra/azure that referenced this pull request Jan 6, 2024
<Actions>
<action
id="f410411e63aff4bb73a81c2aec1d373cf8a903e63b30dee2006b0030d8a94cc8">
        <h3>Bump Terraform `azurerm` provider version</h3>
<details
id="1d9343c012f5434ac9fe8a98135bae3667b399259be16d9b14302ea3bd424a24">
            <summary>Update Terraform lock file</summary>
<p>&#34;hashicorp/azurerm&#34; updated from &#34;3.85.0&#34; to
&#34;3.86.0&#34; in file &#34;.terraform.lock.hcl&#34;</p>
            <details>
                <summary>3.86.0</summary>
<pre>Changelog retrieved
from:&#xA;&#x9;https://github.com/hashicorp/terraform-provider-azurerm/releases/tag/v3.86.0&#xA;FEATURES:&#xA;&#xA;*
New Data Source: `azurerm_dashboard_grafana`
([#24243](hashicorp/terraform-provider-azurerm#24243
New Resource: `azurerm_log_analytics_workspace_table`
([#24229](hashicorp/terraform-provider-azurerm#24229
New Resource: `azurerm_automation_powershell72_module`
([#23980](hashicorp/terraform-provider-azurerm#23980
New Resource: `azurerm_data_factory_credential_user_managed_identity`
([#24307](https://github.com/hashicorp/terraform-provider-azurerm/issues/24307))&#xA;&#xA;ENHANCEMENTS:&#xA;&#xA;*
dependencies: updating to `v0.20231215.1114251` of
`hashicorp/go-azure-sdk`
([#24251](hashicorp/terraform-provider-azurerm#24251
dependencies: `azurerm_spring_cloud_api_portal` - update to use
`hashicorp/go-azure-sdk`
([#24321](hashicorp/terraform-provider-azurerm#24321
Data Source: `azurerm_kusto_cluster` - now exports the `identity` block
([#24314](hashicorp/terraform-provider-azurerm#24314
`azurerm_data_protection_backup_policy_postgresql` - support for the
`time_zone` property
([#24312](hashicorp/terraform-provider-azurerm#24312
`azurerm_data_protection_backup_policy_disk` - support for the
`time_zone` property
([#24312](hashicorp/terraform-provider-azurerm#24312
`azurerm_key_vault_managed_hardware_security_module` -the `tags`
property can now be updated
([#24333](hashicorp/terraform-provider-azurerm#24333
`azurerm_logic_app_standard` - support for the
`site_config.0.public_network_access_enabled` property
([#24257](hashicorp/terraform-provider-azurerm#24257
`azurerm_log_analytics_workspace_table` - support for the `plan`
property
([#24341](hashicorp/terraform-provider-azurerm#24341
`azurerm_linux_web_app` - support the value `20-lts` for the
`node_version` property
([#24289](hashicorp/terraform-provider-azurerm#24289
`azurerm_recovery_services_vault` - support creation with immutability
set to locked
([#23806](hashicorp/terraform-provider-azurerm#23806
`azurerm_spring_cloud_service` - support for the `sku_tier` property
([#24103](https://github.com/hashicorp/terraform-provider-azurerm/issues/24103))&#xA;&#xA;BUG
FIXES:&#xA;&#xA;* Data Source: `azurerm_role_definition` - correctly
export the `role_definition_id` attribute
([#24320](hashicorp/terraform-provider-azurerm#24320
`azurerm_bot_service` - fixing a bug where
`public_network_access_enabled` was always set to `true`
([#24255](hashicorp/terraform-provider-azurerm#24255
`azurerm_bot_service_azure_bot` - `tags` can now be updated
([#24332](hashicorp/terraform-provider-azurerm#24332
`azurerm_cosmosdb_account` - fix validation for the `ip_range_filter`
property
([#24306](hashicorp/terraform-provider-azurerm#24306
`azurerm_linux_virtual_machine` - the
`additional_capabilities.0.ultra_ssd_enabled` can now be changed during
the update
([#24274](hashicorp/terraform-provider-azurerm#24274
`azurerm_logic_app_standard` - update the default value of `version`
from `~3` which is no longer supported to `~4`
([#24134](hashicorp/terraform-provider-azurerm#24134
`azurerm_logic_app_standard` - fix a crash when setting the default
`version` 4.0 flag
([#24322](hashicorp/terraform-provider-azurerm#24322
`azurerm_iothub_device_update_account` - changing the `sku` property now
creates a new resource
([#24324](hashicorp/terraform-provider-azurerm#24324
`azurerm_iothub` - prevent an inconsistant value after an apply
([#24326](hashicorp/terraform-provider-azurerm#24326
`azurerm_orchestrated_virtual_machine_scale_set` - correctly update the
resource when hotpatch is enabled
([#24335](hashicorp/terraform-provider-azurerm#24335
`azurerm_windows_virtual_machine` - the
`additional_capabilities.0.ultra_ssd_enabled` can now be changed during
the update
([#24274](hashicorp/terraform-provider-azurerm#24274
`azurerm_scheduled_query_rules_alert` - changing the `data_source_id`
now creates a new resource
([#24327](hashicorp/terraform-provider-azurerm#24327
`azurerm_scheduled_query_rules_log` - changing the `data_source_id` now
creates a new resource
([#24327](https://github.com/hashicorp/terraform-provider-azurerm/issues/24327))&#xA;&#xA;&#xA;</pre>
            </details>
        </details>
<a
href="https://infra.ci.jenkins.io/job/terraform-jobs/job/azure/job/main/985/">Jenkins
pipeline link</a>
    </action>
</Actions>

---

<table>
  <tr>
    <td width="77">
<img src="https://www.updatecli.io/images/updatecli.png" alt="Updatecli
logo" width="50" height="50">
    </td>
    <td>
      <p>
Created automatically by <a
href="https://www.updatecli.io/">Updatecli</a>
      </p>
      <details><summary>Options:</summary>
        <br />
<p>Most of Updatecli configuration is done via <a
href="https://www.updatecli.io/docs/prologue/quick-start/">its
manifest(s)</a>.</p>
        <ul>
<li>If you close this pull request, Updatecli will automatically reopen
it, the next time it runs.</li>
<li>If you close this pull request and delete the base branch, Updatecli
will automatically recreate it, erasing all previous commits made.</li>
        </ul>
        <p>
Feel free to report any issues at <a
href="https://github.com/updatecli/updatecli/issues">github.com/updatecli/updatecli</a>.<br
/>
If you find this tool useful, do not hesitate to star <a
href="https://github.com/updatecli/updatecli/stargazers">our GitHub
repository</a> as a sign of appreciation, and/or to tell us directly on
our <a
href="https://matrix.to/#/#Updatecli_community:gitter.im">chat</a>!
        </p>
      </details>
    </td>
  </tr>
</table>

Co-authored-by: Jenkins Infra Bot (updatecli) <60776566+jenkins-infra-bot@users.noreply.github.com>
Copy link

github-actions bot commented May 1, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_automation_module is not supporting Powershell 7.2 runtime
3 participants