Hi,
I am currently trying to deploy an infrastructure with Terraform and I have the following need:
My main.tf is :
resource "aws_fsx_ontap_storage_virtual_machine" "svm" {
for_each = { for key, value in jsondecode(file("${path.cwd}/config/svm.json")) : key => value }
file_system_id = aws_fsx_ontap_file_system.fsx.id
name = each.value.name
}
resource "aws_fsx_ontap_volume" "volume" {
for_each = { for key, value in jsondecode(file("${path.cwd}/config/volumes.json")) : key => value }
storage_virtual_machine_id = each.value.storage_virtual_machine_id
}
Both resources are created with for_each (the configurations are in json files).
In resource aws_fsx_ontap_volume, I need to get the attribute id of resource aws_fsx_ontap_storage_virtual_machine.
My volumes.json file is :
{
"vol01": {
"storage_virtual_machine_id": Here I need to put the ids of resource aws_fsx_ontap_storage_virtual_machine (for example aws_fsx_ontap_storage_virtual_machine.svm["svm02"].id)
}
Is there a simple way to do that ?
Thanks a lot.