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_log_analytics_solution unexpected status 200 with response: {"plan":{"name": . . . #23312

Closed
1 task done
mailbox171 opened this issue Sep 19, 2023 · 8 comments · Fixed by #23333
Closed
1 task done

Comments

@mailbox171
Copy link

mailbox171 commented Sep 19, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.5.1

AzureRM Provider Version

3.73.0.

Affected Resource(s)/Data Source(s)

azurerm_log_analytics_solution

Terraform Configuration Files

# Not possible to reproduce with minimal config


resource "azurerm_log_analytics_solution" "solution" {
  for_each = var.solution_names

  solution_name         = each.key
  location              = var.location
  resource_group_name   = var.resource_group_name
  workspace_resource_id = var.workspace_resource_id
  workspace_name        = var.workspace_name

  plan {
    publisher = var.publisher
    product   = "OMSGallery/${each.key}"
  }

  tags = var.tags
}

Debug Output/Panic Output

╷
│ Error: creating/updating Solution (Subscription: "***"
│ Resource Group Name: "rg-sdp-prod"
│ Solution Name: "ContainerInsights(log-prod)"): performing CreateOrUpdate: unexpected status 200 with response: {"plan":{"name":"ContainerInsights(log-prod)","publisher":"Microsoft","promotionCode":"","product":"OMSGallery/ContainerInsights"},"properties":{"workspaceResourceId":"/subscriptions/***/resourceGroups/rg-sdp-prod/providers/Microsoft.OperationalInsights/workspaces/log-prod","provisioningState":"Succeeded","creationTime":"Thu, 11 May 2023 10:11:26 GMT","lastModifiedTime":"Tue, 19 Sep 2023 07:50:54 GMT","containedResources":[],"workbookTemplates":[]},"location":"northeurope","tags":{"AppName":"ADAS - Advanced Driver Assistance System","Environment":"Production","StableforReservation":"No","WBS Code":"P19111"},"id":"/subscriptions/***/resourceGroups/rg-sdp-prod/providers/Microsoft.OperationsManagement/solutions/ContainerInsights(log-prod)","name":"ContainerInsights(log-prod)","type":"Microsoft.OperationsManagement/solutions"}
│ 
│   with module.loganalytics_solutions.azurerm_log_analytics_solution.solution["ContainerInsights"],
│   on .terraform/modules/loganalytics_solutions/loganalytics_solution/main.tf line 1, in resource "azurerm_log_analytics_solution" "solution":
│    1: resource "azurerm_log_analytics_solution" "solution" {
│ 
╵
Error: Process completed with exit code 1.

Expected Behaviour

Just tags updated, as for PLAN below

# module.loganalytics_solutions.azurerm_log_analytics_solution.solution["ContainerInsights"] will be updated in-place
  ~ resource "azurerm_log_analytics_solution" "solution" {
        id                    = "/subscriptions/***/resourceGroups/rg-sdp-prod/providers/Microsoft.OperationsManagement/solutions/ContainerInsights(log-prod)"
      ~ tags                  = {
          - "AppName"              = "ADAS - Advanced Driver Assistance System" -> null
          - "Environment"          = "Production" -> null
          - "StableforReservation" = "No" -> null
          - "WBS Code"             = "P19111" -> null
        }
        # (5 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Actual Behaviour

APPLY fails with error

╷
│ Error: creating/updating Solution (Subscription: "***"
│ Resource Group Name: "rg-sdp-prod"
│ Solution Name: "ContainerInsights(log-prod)"): performing CreateOrUpdate: unexpected status 200 with response: {"plan":{"name":"ContainerInsights(log-prod)","publisher":"Microsoft","promotionCode":"","product":"OMSGallery/ContainerInsights"},"properties":{"workspaceResourceId":"/subscriptions/***/resourceGroups/rg-sdp-prod/providers/Microsoft.OperationalInsights/workspaces/log-prod","provisioningState":"Succeeded","creationTime":"Thu, 11 May 2023 10:11:26 GMT","lastModifiedTime":"Tue, 19 Sep 2023 07:50:54 GMT","containedResources":[],"workbookTemplates":[]},"location":"northeurope","tags":{"AppName":"ADAS - Advanced Driver Assistance System","Environment":"Production","StableforReservation":"No","WBS Code":"P19111"},"id":"/subscriptions/***/resourceGroups/rg-sdp-prod/providers/Microsoft.OperationsManagement/solutions/ContainerInsights(log-prod)","name":"ContainerInsights(log-prod)","type":"Microsoft.OperationsManagement/solutions"}
│ 
│   with module.loganalytics_solutions.azurerm_log_analytics_solution.solution["ContainerInsights"],
│   on .terraform/modules/loganalytics_solutions/loganalytics_solution/main.tf line 1, in resource "azurerm_log_analytics_solution" "solution":
│    1: resource "azurerm_log_analytics_solution" "solution" {
│ 
╵
Error: Process completed with exit code 1.

Steps to Reproduce

terraform plan
terraform apply

Important Factoids

We provisioned in may with latest 3.x version of the provider available at that time.
We had recently manually created a diagnostic setting in the AKS cluster using the workspace, but we have removed everything and restored the previous situation (all TF provisioned).

References

No

@mailbox171
Copy link
Author

mailbox171 commented Sep 19, 2023

Looking in Azure Portal at the Activity log of "ContainerInsights(log-prod)" Solution, It seems that even if the TF PLAN shows only tags to be updated (which is CORRECT), a new OMS Solution is created everytime we TF APPLY.
I attach the JSON description.

Create-new-OMS-solution.json.txt

@ziyeqf
Copy link
Contributor

ziyeqf commented Sep 20, 2023

Hi @mailbox171, thanks for reporting.

It was found the API definition for the update operation has some issue, An issue on azure-rest-api-specs has been raised(Azure/azure-rest-api-specs#25866), once it fixed we can fix it in our provider.

For any other questions please leave comments.

@mailbox171
Copy link
Author

Thank you very much!

Looks like the issue is there in provider 3.73.0, but was not there in previsous version.
Do you have an idea about when it was introduced?

ziyeqf added a commit to ziyeqf/terraform-provider-azurerm that referenced this issue Sep 20, 2023
Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>
@ziyeqf
Copy link
Contributor

ziyeqf commented Sep 20, 2023

This should be introduced on this PR (#23088) which affected 3.72.0 and 3.73.0.

And just found it could be fixed in our provider, Have submitted a PR (#23333 ) for it, once it merged & released, it should be fixed. You can subscribe that PR to keep track on it.

@mailbox171
Copy link
Author

Thanks a lot!

How can I use the fix? I must wait 3.75 is released?

@rcskosir rcskosir added the bug label Sep 20, 2023
stephybun pushed a commit that referenced this issue Sep 21, 2023
…23333)

* `azurerm_log_analytics_solution`: add a test for update

Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>

* fix #23312

Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>

* `azurerm_log_analytics_solution`: refactor to typed sdk

Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>

* add state migration

Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>

* determine if `tag` has changes

Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>

---------

Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>
@github-actions github-actions bot added this to the v3.74.0 milestone Sep 21, 2023
@ziyeqf
Copy link
Contributor

ziyeqf commented Sep 21, 2023

Thanks a lot!

How can I use the fix? I must wait 3.75 is released?

Per the tag of the PR, it will be release on v3.74.0 which is expected to be released this week.

dduportal pushed a commit to jenkins-infra/azure that referenced this issue Sep 23, 2023
<Actions>
<action
id="4a39167e811ac038e4a588362092472c27cfbe9e4929ae61d035f708a093a669">
        <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.73.0&#34; to
&#34;3.74.0&#34; in file &#34;.terraform.lock.hcl&#34;</p>
            <details>
                <summary>3.74.0</summary>
<pre>Changelog retrieved
from:&#xA;&#x9;https://github.com/hashicorp/terraform-provider-azurerm/releases/tag/v3.74.0&#xA;NOTES:&#xA;&#xA;*
`azurerm_synapse_sql_pool` - users that have imported
`azurerm_synapse_sql_pool` resources that were created outside of
Terraform using an `LRS` storage account type will need to use
`ignore_changes` to avoid the resource from being destroyed and
recreated.&#xA;&#xA;FEATURES:&#xA;&#xA;* **New Resource**:
`azurerm_arc_resource_bridge_appliance`
([#23108](hashicorp/terraform-provider-azurerm#23108
**New Resource**: `azurerm_data_factory_dataset_azure_sql_table`
([#23264](hashicorp/terraform-provider-azurerm#23264
**New Resource**: `azurerm_function_app_connection`
([#23127](https://github.com/hashicorp/terraform-provider-azurerm/issues/23127))&#xA;&#xA;ENHANCEMENTS:&#xA;&#xA;*
dependencies: updating to `v0.20230918.1115907` of
`github.com/hashicorp/go-azure-sdk`
([#23337](hashicorp/terraform-provider-azurerm#23337
dependencies: downgrading to `v1.12.5` of `github.com/rickb777/date`
([#23296](hashicorp/terraform-provider-azurerm#23296
`mysql`: updating to use API Version `2022-01-01`
([#23320](hashicorp/terraform-provider-azurerm#23320
`azurerm_app_configuration` - support for the `replica` block
([#22452](hashicorp/terraform-provider-azurerm#22452
`azurerm_bot_channel_directline` - support for `user_upload_enabled`,
`endpoint_parameters_enabled`, and `storage_enabled`
([#23149](hashicorp/terraform-provider-azurerm#23149
`azurerm_container_app` - support for scale rules
([#23294](hashicorp/terraform-provider-azurerm#23294
`azurerm_container_app_environment` - support for zone redundancy
([#23313](hashicorp/terraform-provider-azurerm#23313
`azurerm_container_group` - support for the `key_vault_user_identity_id`
property for Customer Managed Keys
([#23332](hashicorp/terraform-provider-azurerm#23332
`azurerm_cosmosdb_account` - support for MongoDB connection strings
([#23331](hashicorp/terraform-provider-azurerm#23331
`azurerm_data_factory_dataset_delimited_text` - support for the
`dynamic_file_system_enabled`, `dynamic_path_enabled`, and
`dynamic_filename_enabled` properties
([#23261](hashicorp/terraform-provider-azurerm#23261
`azurerm_data_factory_dataset_parquet` - support for the
`azure_blob_fs_location` block
([#23261](hashicorp/terraform-provider-azurerm#23261
`azurerm_monitor_diagnostic_setting` - validation to ensure either
`category` or `category_group` are supplied in `enabled_log` and `log`
blocks
([#23308](hashicorp/terraform-provider-azurerm#23308
`azurerm_network_interface` - support for the `auxiliary_mode` and
`auxiliary_sku` properties
([#22979](hashicorp/terraform-provider-azurerm#22979
`azurerm_postgresql_flexible_server` - increased the maximum supported
value for `storage_mb`
([#23277](hashicorp/terraform-provider-azurerm#23277
`azurerm_shared_image_version` - support for the
`replicated_region_deletion_enabled` and
`target_region.exclude_from_latest_enabled` properties
([#23147](hashicorp/terraform-provider-azurerm#23147
`azurerm_storage_account` - support for setting `domain_name` and
`domain_guid` for `AADKERB`
([#22833](hashicorp/terraform-provider-azurerm#22833
`azurerm_storage_account_customer_managed_key` - support for
cross-tenant customer-managed keys with the
`federated_identity_client_id`, and `key_vault_uri` properties
([#20356](hashicorp/terraform-provider-azurerm#20356
`azurerm_web_application_firewall_policy` - support for the
`rate_limit_duration`, `rate_limit_threshold`, `group_rate_limit_by`,
and `request_body_inspect_limit_in_kb` properties
([#23239](https://github.com/hashicorp/terraform-provider-azurerm/issues/23239))&#xA;&#xA;BUG
FIXES:&#xA;&#xA;* Data Source: `azurerm_container_app_environment`: fix
`log_analytics_workspace_name` output to correct value
([#23298](hashicorp/terraform-provider-azurerm#23298
`azurerm_api_management_api` - set the `service_url` property when
importing the resource
([#23011](hashicorp/terraform-provider-azurerm#23011
`azurerm_app_configuration` - prevent crash by nil checking the
encryption configuration
([#23302](hashicorp/terraform-provider-azurerm#23302
`azurerm_app_configuration_feature` - update `percentage_filter_value`
to accept correct type of float
([#23263](hashicorp/terraform-provider-azurerm#23263
`azurerm_container_app` - fix an issue with `commands` and `args` being
overwritten when using multiple containers
([#23338](hashicorp/terraform-provider-azurerm#23338
`azurerm_key_vault_certificate` - fix issue where certificates
couldn&#39;t be recovered anymore
([#23204](hashicorp/terraform-provider-azurerm#23204
`azurerm_key_vault_key` - the ForceNew when `expiration_date` is removed
from the config file
([#23327](hashicorp/terraform-provider-azurerm#23327
`azurerm_linux_function_app` - fix a bug in setting the storage settings
when using Elastic Premium plans
([#21212](hashicorp/terraform-provider-azurerm#21212
`azurerm_linux_web_app` - fix docker app stack update
([#23303](hashicorp/terraform-provider-azurerm#23303
`azurerm_linux_web_app` - fix crash in auto heal expansion
([#21328](hashicorp/terraform-provider-azurerm#21328
`azurerm_linux_web_app_slot` - fix docker app stack update
([#23303](hashicorp/terraform-provider-azurerm#23303
`azurerm_linux_web_app_slot` - fix crash in auto heal expansion
([#21328](hashicorp/terraform-provider-azurerm#21328
`azurerm_log_analytics_solution` - fix bug where the resource wasn&#39;t
handling successful creation on subsequent applies
([#23312](hashicorp/terraform-provider-azurerm#23312
`azurerm_management_group_subscription_association` - fix bug to
correctly mark resource as gone if not found during read
([#23335](hashicorp/terraform-provider-azurerm#23335
`azurerm_mssql_elasticpool` - remove check that prevents `license_type`
from being set for certain skus
([#23262](hashicorp/terraform-provider-azurerm#23262
`azurerm_servicebus_queue` - fixing an issue where `auto_delete_on_idle`
couldn&#39;t be set to `P10675199DT2H48M5.4775807S`
([#23296](hashicorp/terraform-provider-azurerm#23296
`azurerm_servicebus_topic` - fixing an issue where `auto_delete_on_idle`
couldn&#39;t be set to `P10675199DT2H48M5.4775807S`
([#23296](hashicorp/terraform-provider-azurerm#23296
`azurerm_storage_account` - prevent sending unsupported blob properties
in payload for `Storage` account kind
([#23288](hashicorp/terraform-provider-azurerm#23288
`azurerm_synapse_sql_pool` - expose `storage_account_type`
([#23217](hashicorp/terraform-provider-azurerm#23217
`azurerm_windows_function_app` - fix a bug in setting the storage
settings when using Elastic Premium plans
([#21212](hashicorp/terraform-provider-azurerm#21212
`azurerm_windows_web_app` - fix docker app stack update
([#23303](hashicorp/terraform-provider-azurerm#23303
`azurerm_windows_web_app_slot` - fix docker app stack update
([#23303](https://github.com/hashicorp/terraform-provider-azurerm/issues/23303))&#xA;&#xA;DEPRECATIONS:&#xA;&#xA;*
`azurerm_application_gateway` - deprecate `Standard` and `WAF` skus
([#23310](hashicorp/terraform-provider-azurerm#23310
`azurerm_bot_channel_web_chat` - deprecate `site_names` in favour of
`site` block
([#23161](hashicorp/terraform-provider-azurerm#23161
`azurerm_monitor_diagnostic_setting` - deprecate `retention_policy` in
favour of `azurerm_storage_management_policy`
([#23260](https://github.com/hashicorp/terraform-provider-azurerm/issues/23260))&#xA;&#xA;&#xA;</pre>
            </details>
        </details>
    </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>
@tomaustin700
Copy link

tomaustin700 commented Mar 7, 2024

We're still seeing this using 3.79.0

Error: creating Solution (Subscription: "***"
│ Resource Group Name: "rg-sentinel-prod-uks-001"
│ Solution Name: "SecurityInsights(log-sentinel-001)"): performing CreateOrUpdate: unexpected status 200 with response: {"plan":{"name":"SecurityInsights(log-sentinel-001)","publisher":"Microsoft","promotionCode":"","product":"OMSGallery/SecurityInsights"},"properties":{"workspaceResourceId":"/subscriptions/***/resourceGroups/rg-sentinel-prod-uks-001/providers/Microsoft.OperationalInsights/workspaces/log-sentinel-001","provisioningState":"Succeeded","creationTime":"Thu, 07 Mar 2024 14:24:38 GMT","sku":{"name":"Unified"},"lastModifiedTime":"Thu, 07 Mar 2024 14:24:40 GMT","containedResources":[],"workbookTemplates":[]},"location":"uksouth","tags":{},"id":"/subscriptions/***/resourceGroups/rg-sentinel-prod-uks-001/providers/Microsoft.OperationsManagement/solutions/SecurityInsights(log-sentinel-001)","name":"SecurityInsights(log-sentinel-001)","type":"Microsoft.OperationsManagement/solutions"}
│ 
│   with module.resource_groups.module.rg-sentinel-prod-uks-001.module.sentinel.azurerm_log_analytics_solution.sentinel,
│   on resource_groups\rg-sentinel-prod-uks-001\resources\sentinel\main.tf line 5, in resource "azurerm_log_analytics_solution" "sentinel":
│    5: resource "azurerm_log_analytics_solution" "sentinel" {
│ 
│ creating Solution (Subscription: "***"
│ Resource Group Name: "rg-sentinel-prod-uks-001"
│ Solution Name: "SecurityInsights(log-sentinel-001)"): performing
│ CreateOrUpdate: unexpected status 200 with response:

UPDATE - Bumped up to 3.94.0 and it deployed correctly

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, 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 Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants