terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
azurerm_storage_sync_group - SyncGroup ID parsed into 0 segments
Is there an existing issue for this?
- [X] I have searched the existing issues
Community Note
- Please vote on this issue by adding a :thumbsup: 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.7.3
AzureRM Provider Version
3.94.0
Affected Resource(s)/Data Source(s)
azurerm_storage_sync_group
Terraform Configuration Files
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.94.0"
}
}
}
resource "azurerm_storage_sync" "this" {
name = var.name
location = var.location
resource_group_name = var.resource_group_name
incoming_traffic_policy = var.incoming_traffic_policy
timeouts {
create = "30m"
}
}
resource "azurerm_storage_sync_group" "this" {
for_each = { for n in var.storage_sync_group_names : n => n }
name = each.value
storage_sync_id = azurerm_storage_sync.this.id
}
variable "name" {
description = "(Required) The name which should be used for this Storage Sync."
type = string
}
variable "location" {
description = "(Required) The Azure Region where the Storage Sync should exist."
type = string
}
variable "resource_group_name" {
description = " (Required) The name of the Resource Group where the Storage Sync should exist."
type = string
}
variable "tags" {
description = "(Optional) Tags assigned to all Storage Sync related resources"
type = map(string)
default = {}
}
variable "incoming_traffic_policy" {
description = "(Optional) Incoming traffic policy. Possible values are AllowAllTraffic and AllowVirtualNetworksOnly."
type = string
default = null
}
variable "storage_sync_group_names" {
description = "A list of storage sync group names."
type = list(string)
default = []
}
Debug Output/Panic Output
Error: parsing "/subscriptions/XXXX/resourceGroups/XXXX/providers%2FMicrosoft.StorageSync/storageSyncServices/XXXX/syncGroups/XXXX": parsing the SyncGroup ID: the number of segments didn't match
│
│ Expected a SyncGroup ID that matched (containing 10 segments):
│
│ > /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.StorageSync/storageSyncServices/storageSyncServiceValue/syncGroups/syncGroupValue
│
│ However this value was provided (which was parsed into 0 segments):
│
│ > /subscriptions/XXXX/resourceGroups/XXXX/providers%2FMicrosoft.StorageSync/storageSyncServices/XXXX/syncGroups/XXXX
Expected Behaviour
%2F should be decoded to a forward slash between segments 4 and 5.
Actual Behaviour
%2F is not decoded to a forward slash between segments 4 and 5.
I was initially using AzureRM Provider v3.55.0 and the SyncGroup ID has the encoded forward slash between segments 4 and 5 but does not throw an error.
I upgraded to 3.94.0 and started receiving this error message.
Steps to Reproduce
terraform plan terraform apply
Important Factoids
Azure Government
References
No response
Thanks for raising this issue. Seems I can't repro it on my local. Could you double confirm if the steps are correct? Thanks.
Repro steps:
- Run tf apply to create the Storage Sync and the Storage Sync group using v3.55.0
- Upgrade TF azurerm provider to v3.94.0
- Run tf plan/tf apply against these two resources
tf config:
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-ss-test01"
location = "westeurope"
}
resource "azurerm_storage_sync" "test" {
name = "acctest-SS-test01"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
incoming_traffic_policy = "AllowVirtualNetworksOnly"
}
resource "azurerm_storage_sync_group" "test" {
name = "acctest-StorageSyncGroup-test01"
storage_sync_id = azurerm_storage_sync.test.id
}
Sorry. I forgot to provide the module block.
module "storage_sync" {
source = "../../common-modules/az-storage-sync/"
count = var.storage_sync_name != "" && var.storage_sync_name != null ? 1 : 0
location = var.location
resource_group_name = azurerm_resource_group.rg.name
name = var.storage_sync_name
incoming_traffic_policy = var.storage_sync_incoming_traffic_policy
storage_sync_group_names = var.storage_sync_group_names
private_endpoint_enabled = var.storage_sync_private_endpoint_enabled
private_endpoint_name = var.storage_sync_private_endpoint_name
private_endpoint_subresource_names = var.storage_sync_private_endpoint_subresource_names
subnet_id = data.azurerm_subnet.this.id
tags = merge(var.storage_sync_tags, var.tags)
}
This issue can be closed. I corrected the IDs in my state file to fix the issue.