Closed shivamanga0609 closed 8 months ago
Hello Shiva,
Thank you for your feedback. In looking at the code it's not clear what the issue may be. The only model within the code with a Display Name field is the ResourceComponent.cs class. This model is used when creating a new Custom Component. I can't see in your Terraform script the actual API URL you are posting however, but regardless, this field is not set manually when making a custom component anyway (the site will take the entered name and use that). The error you have also shows the Name field is missing, so I am wondering if it is attempting to create a new custom component. Additionally, the JSON contains a property (resourceunits/Depts) which doesn't exist in the system.
Can you please verify the URL you are using int he Terraform code?
Thank you!
Closed due to inactivity.
Tool version 3.1.0 Describe the bug Terraform giving error
To Reproduce I am configured the components in naming tool according to company standards. I am successfully able to run the API - Resource request name from the swagger tool using bellow Json
curl -X 'POST' \ 'https://test-app/api/ResourceNamingRequests/RequestName' \ -H 'accept: /' \ -H 'APIKey: ***' \ -H 'Content-Type: application/json' \ -d '{ "resourceEnvironment": "t", "resourceInstance":"03", "resourceOrg": "m1", "resourceProjAppSvc": "sap", "resourceType": "vm", "resourceid": 85, "resourceunits/Depts": "db", "customComponents": { } }'
Getting error when I run it through terraform . Here is my terraform script where i am using data http block to generate the name using terraform
locals { common_request_body = { "resourceEnvironment": "t", "resourceInstance":"01", "resourceOrg": "m1", "resourceProjAppSvc": "sap", "resourceType": "vm", "resourceid": 85, "resourceunits/Depts": "db", "customComponents": { } } json_common = jsonencode(local.common_request_body) }
data "http" "resource_naming_request" { url = var.url
method = "POST" request_headers = { Content-Type = "application/json", APIKey = var.APIKey }
request_body = var.is_subscription ? null : local.json_common
}
response_content = "{\"type\":\"https://tools.ietf.org/html/rfc7231#section-6.5.1\",\"title\":\"One or more validation errors occurred.\",\"status\":400,\"traceId\":\"00-a6326ea594869925ab26254a47563f80-f4ba9b7b845000-00\",\"errors\":{\"Name\":[\"The Name field is required.\"],\"DisplayName\":[\"The DisplayName field is required.\"]}}" Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Installation Method A description of the installation environment for the Azure Naming Tool.
Additional context Add any other context about the problem here.