vmware/terraform-provider-vmc

Add SRM instances sequentially when two or more additional instances are created or destroyed

Nareshcbit opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

In a multi-site SRM topology, we must activate multiple SRM instances
https://docs.vmware.com/en/VMware-Site-Recovery/services/com.vmware.srmaas.install_config.doc/GUID-33D7C8D1-B684-4FF9-A8C5-8A1268E1895F.html

Terraform resource available for activating SRM instances is vmc_srm_node

But when multiple vmc_srm_node resources are deployed through for_each, all the nodes are deployed parallely. That is causing API errors and resource creation and deletion is failing

variable srm_additional_instances {
type = map(
object({
extension_key_suffix = string
})
)
default = {
instance-2 = { extension_key_suffix = "instance-2"}
instance-2 = { extension_key_suffix = "instance-3"}
}
}

resource "vmc_srm_node" "srm_node"{
sddc_id = vmc_sddc.sddc_1.id
for_each = var.srm_additional_instances
srm_node_extension_key_suffix = each.value.extension_key_suffix
depends_on = [vmc_site_recovery.site_recovery_1]
}

Errors:

Error: task failed: error creating SRM node: com.vmware.skyscraper.common.BadRequestException: Failed to lock site recovery for sddc id 15a0aff8-7a6f-420c-a3f4-219a00b79918. Try operation again.:skyscraper.draas.siterecovery.operation.lock.failed

Error: task failed: failed to delete SRM node: com.vmware.skyscraper.common.InternalSkyscraperException: SS backend task 19ca602a-7db9-4443-b5de-12ee852c4954 failed: com.vmware.skyscraper.common.BadRequestException: A management VM task is in progress.:skyscraper.management.vm.task.inprogress

Describe the solution you'd like

When more than one SRM node resources have to be created / deleted, perform action sequentially

Describe alternatives you've considered

No response

Additional context

No response