hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
41.68k stars 9.41k forks source link

A reference to a resource type must be followed by at least one attribute access, specifying the resource name. #35428

Closed nikhil0499 closed 2 days ago

nikhil0499 commented 3 days ago

Terraform Version

1.9.0

Terraform Configuration Files

resource "azurerm_api_management_policy_fragment" "policy_fragments" { for_each = fileset(var.policy_fragments_dir, "*.xml") api_management_id = var.apim_instance_ids[var.environment] name = each.key format = "xml" value = file("${var.policy_fragments_dir}/${each.key}") }

Debug Output

│ Error: Invalid reference │ │ on ../../../../modules/api_policy_fragments/main.tf line 16, in resource "azurerm_api_management_policy_fragment" "policy_fragments": │ 16: name = sample │ │ A reference to a resource type must be followed by at least one attribute │ access, specifying the resource name. ╵ Operation failed: failed running terraform plan (exit 1)

Expected Behavior

Create all of the policy fragments

Actual Behavior

A reference to a resource type must be followed by at least one attribute access, specifying the resource name.

Steps to Reproduce

1.terraform init 2.terraform plan

Additional Context

No response

References

No response

nikhil0499 commented 3 days ago

I am trying to iterate the .xml files(which contains policy fragments of Azure APIM) , and deploy this in the APIM

nikhil0499 commented 3 days ago

terraform-provider-azurerm

crw commented 2 days ago

Hello @nikhil0499, this appears to be an issue or question with the AzureRM provider, not with Terraform itself. You can see existing issues and file a new one in their repository here: https://github.com/terraform-providers/terraform-provider-azurerm/issues. If you have questions about Terraform or the AzureRM provider, it's better to use the community forum where there are more people ready to help. The GitHub issues here are monitored only by a few core maintainers. Thanks!