Mapping resource URLs to Terraform resource names
zjpiazza opened this issue · 2 comments
Hi,
I was able to set the Swagger URL and initialize the provider successfully. However, when I go and try and create the resource in question I get an error saying it's an invalid resource. The resource I am trying to create has the following URL: /api/v0/repositories/{namespace}. Here is a snippet of the Swagger doc:
"/api/v0/repositories/{namespace}": {
"post": {
"description": "\n*Authorization:* Client must be authenticated as a user who has admin access to the\nrepository namespace (i.e., user owns the repo or is a member of a team with\n\"admin\" level access to the organization's namespace of repositories).\n\t\t",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"repositories"
],
"summary": "Create repository",
"operationId": "CreateRepository",
"parameters": [
{
"type": "string",
"description": "namespace/owner of repository",
"name": "namespace",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/forms.CreateRepo"
}
}
],
"responses": {
"201": {
"description": "success",
"schema": {
"$ref": "#/definitions/responses.Repository"
}
},
"400": {
"description": "REPOSITORY_EXISTS: A repository with the same name already exists."
},
"401": {
"description": "NOT_AUTHENTICATED: The client is not authenticated."
},
"403": {
"description": "NOT_AUTHORIZED: The client is not authorized."
},
"404": {
"description": "NO_SUCH_ACCOUNT: An account with the given name does not exist."
},
"405": {
"description": "NOT_ALLOWED: Method Not Allowed"
},
"406": {
"description": "NOT_ACCEPTABLE: Not Acceptable"
},
"415": {
"description": "UNSUPPORTED_MEDIA_TYPE: Unsupported Media Type"
}
}
}
},
So going off of the examples, the I figured the name of the resource would be dtr_repositories_v0 but no luck. I have also tried dtr_api_v0_repositories, dtr_repositories any many others but they all fail with the same response: Error: Invalid resource type
. The only difference I can tell from the examples in the repo and the API I'm trying to map to is the path begins with /api instead of the version number. Is there additional parameters I need to set to make this work?
Hi @zjpiazza ,
The "How To" documentation has details on the requirements for endpoints to be considered terraform compliant resources. Please refer to the terraform-compliant-resource section to learn more about this.
Let me know if that helps.
Thanks
Dani