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

Error parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups" #18210

Closed
1 task done
nimmyarjith opened this issue Sep 1, 2022 · 16 comments

Comments

@nimmyarjith
Copy link

nimmyarjith commented Sep 1, 2022

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

Terraform Version

v0.13.5

AzureRM Provider Version

v2.99.0

Affected Resource(s)/Data Source(s)

resource "azurerm_app_service" and resource "azurerm_function_app"

Terraform Configuration Files

resource "azurerm_app_service" "appservice" {
  name                    = var.appservice_app_name
  location                = var.location
  resource_group_name     = var.app_resource_group
  app_service_plan_id     = data.azurerm_app_service_plan.app_service_plan.id
  https_only              = true
  client_affinity_enabled = var.client_affinity_enabled

  app_settings = merge(var.appsettings, local.app_settings)

  identity {
    type         ="UserAssigned"
    identity_ids = var.user_assigned_managed_identity_ids
  } 

  site_config {
    always_on                 = var.always_on
    default_documents         = var.default_documents
    use_32_bit_worker_process = var.use_32_bit_worker_process

    cors {
      allowed_origins = var.cors_origins
    }
  }
 
}

Debug Output/Panic Output

Error parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

Expected Behaviour

Saw one thread which says this has been fixed in azurerm version v2.88.1 #14456
But we still get issue while using the version v2.99.0
When pinning to azurerm = v2.87.0" this is working. Should work with versions greater than v2.88.1

Actual Behaviour

Throws error Error parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups" while creating function app and app service.

Steps to Reproduce

resource "azurerm_app_service" "appservice" {
name = var.appservice_app_name
location = var.location
resource_group_name = var.app_resource_group
app_service_plan_id = data.azurerm_app_service_plan.app_service_plan.id
https_only = true
client_affinity_enabled = var.client_affinity_enabled

app_settings = merge(var.appsettings, local.app_settings)

identity {
type ="UserAssigned"
identity_ids = var.user_assigned_managed_identity_ids
}

site_config {
always_on = var.always_on
default_documents = var.default_documents
use_32_bit_worker_process = var.use_32_bit_worker_process

cors {
  allowed_origins = var.cors_origins
}

}

}

Important Factoids

No response

References

#14456

@nimmyarjith nimmyarjith added the bug label Sep 1, 2022
@github-actions github-actions bot removed the bug label Sep 1, 2022
@swapnilpotnis
Copy link

Same is the case with DataExports

parsing segment "staticDataExports": expected the segment "dataexports" to be "dataExports"

@dan-leanix
Copy link

I would like to raise the general question here why those changes are now introduced and breaking dozens of Terraform deployments?

@tombuildsstuff @katbyte Can you shed some light on this? Thanks.

The first one I have seen was the one with version 3.19 related to Azure DNS #18104

@bennyguk
Copy link
Contributor

bennyguk commented Sep 8, 2022

We're run in to this issue today with version 3.21.1 of the provider with azurerm_log_analytics_solution which generates the same error:

parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

Confirmed that this was not an issue in version 3.20.0, but I've also tested with 3.21.0 and that gives the same error.

@bennyguk
Copy link
Contributor

bennyguk commented Sep 9, 2022

We're run in to this issue today with version 3.21.1 of the provider with azurerm_log_analytics_solution which generates the same error:

parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

Confirmed that this was not an issue in version 3.20.0, but I've also tested with 3.21.0 and that gives the same error.

Tested today with 3.22.0 and seems to be fixed now.

@flavio-neves
Copy link

flavio-neves commented Sep 9, 2022

Still happening for azurerm_monitor_diagnostic_setting resources with version 3.22.0.

Need to pin version 3.20 to work.

Edit, including screenshot.
image

@J0F3
Copy link

J0F3 commented Sep 12, 2022

I have just opened a new issue for azurerm_monitor_diagnostic_setting: #18346

@Amier3
Copy link
Contributor

Amier3 commented Sep 12, 2022

Hey ya'll 👋

We're aware of this issue and actively working on a fix, thanks to everyone for the reporting on/upvoting this issue for visibility! @dan-leanix my response on a similar issue #18235 (comment) gives a little context into why these issues tend to come up every now and then.

@nimmyarjith
Copy link
Author

@Amier3 we can see from other threads that this has been fixed in azurerm version [v3.22.0]. But the resource https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service itself is not supported in version 3.0. Is there any chance we can get this issue fixed in azurerm ~> 2.20 version. It is difficult to switch to new TF resource( azurerm_linux_web_app and azurerm_windows_web_app) for existing appservices created via azurerm_app_service resource

@nimmyarjith
Copy link
Author

Any update on this please?

@ValeruS
Copy link

ValeruS commented Dec 2, 2022

the same issue with kubernetes AKS
│ Error: parsing "/subscriptions/ID/resourcegroups/RG/providers/Microsoft.ContainerService/managedClusters/1AKS": parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

@Erylis21
Copy link

Erylis21 commented Feb 10, 2023

The same issue appeared on "azurerm_virtual_machine":

Error: flattening storage_os_disk: &errors.errorString{s:"parsing Disk ID "/subscriptions/XXX/resourcegroups/XXX/providers/Microsoft.Compute/disks/XXX": parsing "/subscriptions/XXX/resourcegroups/XXX/providers/Microsoft.Compute/disks/XXX": parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups""}

@mcereda
Copy link

mcereda commented Feb 24, 2023

Regarding AKS, the following versions worked for me: 3.10.0 and 3.22.0 to 3.28.0
I tried using versions 3.20.0, 3.21.0 and 3.29.0 to 3.44.1, but got the same

parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

error on refresh on the azurerm_kubernetes_cluster resource.

@okoudje
Copy link

okoudje commented Apr 3, 2023

The same issue appeared on "azurerm_kubernetes_cluster":

parsing segment "staticResourceGroups": expected the segment "resourcegroups" to be "resourceGroups"

Terraform v1.3.9
azurerm v3.40.0

@tombuildsstuff
Copy link
Contributor

@ValeruS @okoudje @mcereda based on the error messages above it appears that your the Resource ID used to import this resource into Terraform may have been in a different casing to that defined in the import section of the documentation for the AKS Resource (which expects resourceGroups rather than resourcegroups) - so you'd need to ensure the correct casing is being specified when importing resources.

If you've imported this resource into Terraform previously, you can update this using terraform state rm azurerm_kubernetes_cluster.{name} to remove the existing resource from the state and then terraform import azurerm_kubernetes_cluster.{name} {id, using 'resourceGroups'} to re-import this resource into Terraform. Alternatively you can update the State file to account for this.


Since it appears the original issue has been fixed here I'm going to close this issue for the moment, if you're still seeing this error then please ensure that the ID being provided matches what's defined for this Resource ID against the relevant resource in Terraform.

Unfortunately the Azure API returns Resource IDs inconsistently, so whilst they're supposed to be defined and returned in camelCase (e.g. virtualMachines) the Azure Portal (and some APIs) differ returning these as VirtualMachines or virtualmachines) - however Terraform requires a constant Resource ID value - and as such we're now validating that the Resource ID provided matches the value defined within the import section of the documentation.

As such, if you're still seeing this issue then I'd recommend checking the Resource ID being provided, but if you're still having issues using the latest version of the Provider then please let us know (with the output of which Resource you're using and the Resource ID being specified) and we can take a look.

Thanks!

@spotakash
Copy link

spotakash commented Jun 22, 2023

@tombuildsstuff This issue is still happening. I am trying to create new cluster by providing Log Analytics workspace resource ID and it keeps throwing error.
image

  • AzureRM version 3.61.0 & 3.50.0
  • Terraform v1.3.7

note: I am not doing any import

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 May 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests