kevholditch / terraform-provider-kong

kong provider for terraform
MIT License
179 stars 91 forks source link

Argument "name" in resource kong_route not expected #114

Closed igorceridorio closed 3 years ago

igorceridorio commented 4 years ago

Hi there,

I ran into an issue that might be an error regarding creation of a new kong_route using the version 1.12.0. I am working with Terraform v0.13.3.

When I try to create a new kong_route specifying a parameter name = "route-name" I get the following error:

Error: Unsupported argument

  on main.tf line 24, in resource "kong_route" "route-api-example-endpoint":
  24:     name            = "route-api-example/endpoint"

An argument named "name" is not expected here.

Interesting, though, is that when I create a kong_service and specify a parameter name everything works fine. Below is my .tf example file.

Affected Resource(s)

Terraform Configuration Files

terraform {
    required_providers {
        kong = {
            source = "example.com/mycorp/kong"
            version = "~> 1.12.0"
        }
    }
}    

provider "kong" {
    kong_admin_uri      = var.kong_admin_uri
    kong_admin_username = var.kong_admin_username
    kong_admin_password = var.kong_admin_password
}

resource "kong_service" "service-api-example" {
    name        = "service-api-example"
    protocol    = "http"
    host        = "httpbin.org"
    port        = 80
}

resource "kong_route" "route-api-example-endpoint" {
    name            = "route-api-example/endpoint"
    methods         = [ "GET" ]
    protocols       = [ "http" ]
    paths           = ["/get"]
    strip_path      = true
    preserve_host   = false
    service_id      = kong_service.service-api-example.id
}

So I switched back to provider version 5.2.1 and executing the same .tf file everything works as expected and the name parameter of kong_route just works.

Any thoughts on that? Thanks!

vaibhavkhurana2018 commented 3 years ago

This is because the provider was updated with reference to kong v1.0.0.

The release date is confusing because 1.12 is updated post 5.2.1, but if you see the readme, it is mentioned to use >v2.0 https://github.com/kevholditch/terraform-provider-kong#important

It's the date that would have confused.