Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid terraform compliant endpoint not available as resource in the plugin #176

Closed
2 tasks done
dikhan opened this issue Oct 31, 2019 · 0 comments · Fixed by #177
Closed
2 tasks done

Valid terraform compliant endpoint not available as resource in the plugin #176

dikhan opened this issue Oct 31, 2019 · 0 comments · Fixed by #177

Comments

@dikhan
Copy link
Owner

dikhan commented Oct 31, 2019

Describe the bug

Not able to see the cdn exposed as resource given the following swagger file. Getting the following error:

The provider provider.openapi does not support resource "openapi_cdn_v1".

Example swagger file:

swagger: "2.0"
host: 127.0.0.1 
paths:

  ######################
  ## CDN parent resource 
  ######################

  /v1/cdns:
    post:
      x-terraform-resource-name: "cdn"
      parameters:
      - in: "body"
        name: "body"
        schema:
          $ref: "#/definitions/ContentDeliveryNetworkV1"
      responses:
        201:
          schema:
            $ref: "#/definitions/ContentDeliveryNetworkV1"
  /v1/cdns/{cdn_id}:
    get:
      parameters:
      - name: "cdn_id"
        in: "path"
        description: "The cdn id that needs to be fetched."
        required: true
        type: "string"
      responses:
        200:
          schema:
            $ref: "#/definitions/ContentDeliveryNetworkV1"

  ######################
  ## CDN sub-resource
  ######################

  /v1/cdns/{cdn_id}/v1/firewalls:
    get:
      summary: List cdns firewalls
      parameters:
      - name: cdn_id
      in: path
      required: true
      type: string
      responses:
       '200':
         description: OK
         schema:
           $ref: '#/definitions/ContentDeliveryNetworkFirewallV1Collection'
    post:
      x-terraform-resource-host: 178.168.3.4
      parameters:
      - name: "cdn_id"
        in: "path"
        description: "The cdn id that contains the firewall to be fetched."
        required: true
        type: "string"
      - in: "body"
        name: "body"
        description: "Created CDN firewall"
        required: true
        schema:
          $ref: "#/definitions/ContentDeliveryNetworkFirewallV1"
      responses:
        201:
          schema:
            $ref: "#/definitions/ContentDeliveryNetworkFirewallV1"
  /v1/cdns/{cdn_id}/v1/firewalls/{id}:
    get:
      parameters:
      - name: "cdn_id"
        in: "path"
        description: "The cdn id that contains the firewall to be fetched."
        required: true
        type: "string"
      - name: "id"
        in: "path"
        description: "The cdn firewall id that needs to be fetched."
        required: true
        type: "string"
      responses:
        200:
          schema:
            $ref: "#/definitions/ContentDeliveryNetworkFirewallV1"
    delete:
      parameters: 
        - description: "The cdn id that contains the firewall to be fetched."
          in: path
          name: parent_id
          required: true
          type: string
        - description: "The cdn firewall id that needs to be fetched."
          in: path
          name: id
          required: true
          type: string
      responses: 
        204:
    put:
      x-terraform-resource-timeout: "300s"
      parameters:
      - name: "id"
        in: "path"
        description: "firewall that needs to be updated"
        required: true
        type: "string"
      - name: "parent_id"
        in: "path"
        description: "cdn which this firewall belongs to"
        required: true
        type: "string"
      - in: "body"
        name: "body"
        description: "Updated firewall object"
        required: true
        schema:
          $ref: "#/definitions/ContentDeliveryNetworkFirewallV1"
      responses:
        200:
          schema:
            $ref: "#/definitions/ContentDeliveryNetworkFirewallV1"

definitions:
  ContentDeliveryNetworkFirewallV1Collection:
    type: array
    items:
      $ref: '#/definitions/ContentDeliveryNetworkFirewallV1'
  ContentDeliveryNetworkFirewallV1:
    type: "object"
    properties:
      id:
        type: "string"
        readOnly: true
      label:
        type: "string"
  ContentDeliveryNetworkV1:
    type: "object"
    required:
      - label
    properties:
      id:
        type: "string"
        readOnly: true
      label:
        type: "string"

To Reproduce

A clear and concise description on how does it work now and what's the current behaviour.

Steps to reproduce the behaviour:

  1. Given the example swagger file above and the following tf config file
resource "openapi_cdn_v1" "my_cdn" {}
  1. When the plugin is executed
  2. The provider would not have available the 'cdn_v1' resource and the logging output would show something like:
2019/10/31 09:57:34 [WARN] 'cdn_v1' is a duplicate resource name and is being removed from the provider

Expected behaviour

I should be able to create cdn_v1 resource:

resource "openapi_cdn_v1" "my_cdn" {}

Additional context

Add any other context about the problem here.

Checklist

Don't forget to go through the checklist to make sure the issue is created properly:

  • I have added a corresponding label (feature request/bug/etc) to the issue (right side menu)
  • I have added this issue to the 'API Terraform Provider' GitHub project (right side menu)
@dikhan dikhan added the bug label Oct 31, 2019
@dikhan dikhan added this to Backlog in API Terraform Provider (OpenAPI 2.0) via automation Oct 31, 2019
@dikhan dikhan mentioned this issue Oct 31, 2019
7 tasks
@dikhan dikhan moved this from Backlog to In progress in API Terraform Provider (OpenAPI 2.0) Oct 31, 2019
API Terraform Provider (OpenAPI 2.0) automation moved this from In progress to Done Oct 31, 2019
dikhan added a commit that referenced this issue Oct 31, 2019
- #171: Support resources where POST operation does not expect any inputs
- #176: Valid terraform compliant endpoint not available as resource in the plugin
- #178: Internal process that checks terraform compliant resources is run twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant