Git Product home page Git Product logo

terraform-provider-apisix's Introduction

terraform-provider-apisix

!!!no longer supported by me !!!

Only from 2.11.0

Don't use without next hook. Docs

local apisix = require("apisix")
local core = require("apisix.core")

local old_http_init = apisix.http_init
apisix.http_init = function(...)

    local old_core_table_path = core.table.patch
    core.table.patch = function(node_value, sub_path, conf)
        if sub_path == "__patch_terraform_plugin_apisix__" then
            return old_core_table_path(conf, "", conf)
        else
            return old_core_table_path(node_value, sub_path, conf)
        end
    end

    old_http_init(...)
end

terraform-provider-apisix's People

Contributors

suslovsergey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

terraform-provider-apisix's Issues

Unexpected error: unexpected end of JSON input

resource "apisix_route" "base" {
name = var.service_name
host = var.service_domain
uris = ["/*"]
methods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE"]
upstream = {
type = "roundrobin"
nodes = [{
host = var.upstream_host
port = 80
weight = 1
}]
}
}

every inputs is ok when plan, but got exception while apply

Value Conversion Error

Hi and thanks for the Terraform provider for APISIX.

I'm having a problem using the provider. When installing a simple upstream:

resource "apisix_upstream" "test" {
  name = "test"
  type = "roundrobin"
}

I get the error:

│ Error: Value Conversion Error
│ 
│   with apisix_upstream.test,
│ An unexpected error was encountered trying to convert tftypes.Value into model.UpstreamType. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ error retrieving field names from struct tags: need a struct tag for "tfsdk" on UpstreamWithoutIDType

I'm i doing something wrong?
Any help is appreciated.

Apisix Plugin patch ... I need more info

Thanks for the Terraform provider for APISIX.

Could you please add some more information on how patching APISIX.

I understand that I have to:

  1. copy the lua files of apisix-lua/plugins to apisix plugin directory
  2. provide the apisix's config.yml with the hook and the plugin directory such as:
+  extra_lua_path: "/usr/local/apisix/lua/apisix-lua/?.lua"
+  lua_module_hook: "terraform-hook"

3 the hook should load the plugin...

I am not well versed in LUA so I'm sorry to ask but I think that I need to change your hook code to something else

  if sub_path == "__patch_terraform_plugin_apisix__" then
      return old_core_table_path(conf, "", conf)
   else

as the hook is loaded with no error but the provider is not working.

Should I change "patch_terraform_plugin_apisix" to the "extra_lua_path" ?

Any help is appreciated.

Plugin Crash

Hello,
When testing the plugin with a simple install:

resource "apisix_upstream" "test" {
  name = "test"
  type = "roundrobin"
  nodes          = [
  {
  host   = "1.1.1.1"
  port   = 80
  weight = 1
},
]

The plugin crashes:

╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-apisix plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 67 [running]:
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.parseHttpResult(0xc000546000, 0xc0000e0400, 0x1e3, 0x200, 0x1e3, 0x200, 0x0, 0x0, 0xc000287001, 0xc00042f6e0)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client.go:67 +0x526
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.ApiClient.Get(0xc0001cef30, 0x27, 0x11e8960, 0xc0004404c0, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client.go:87 +0x1d1
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.ApiClient.RunObject(0xc0001cef30, 0x27, 0x11e8960, 0xbe0528, 0x3, 0xc0004404c0, 0x1f, 0x0, 0x0, 0x0, ...)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client.go:182 +0x389
github.com/webbankir/terraform-provider-apisix/apisix/api_clent.ApiClient.GetUpstream(...)
        github.com/webbankir/terraform-provider-apisix/apisix/api_clent/api_client_upstream.go:4
github.com/webbankir/terraform-provider-apisix/apisix.ResourceUpstreamType.Read(0x203000, 0xc0001cef30, 0x27, 0x11e8960, 0xcfe4a0, 0xc000422340, 0xd04e40, 0xc00042bf50, 0xb06160, 0xc000428b10, ...)
        github.com/webbankir/terraform-provider-apisix/apisix/resource_apisix_upstream.go:86 +0x1b5
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).readResource(0xc0005a24e0, 0xcfe4a0, 0xc000422340, 0xc000422300, 0xc000287a18)
        github.com/hashicorp/[email protected]/tfsdk/serve.go:571 +0x683
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).ReadResource(0xc0005a24e0, 0xcfe4a0, 0xc0004222c0, 0xc000422300, 0xbea4d5, 0x12, 0x0)
        github.com/hashicorp/[email protected]/tfsdk/serve.go:506 +0xe4
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc000212300, 0xcfe4a0, 0xc0004222c0, 0xc00059da40, 0x0, 0x0, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:554 +0x30d
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler(0xbb3340, 0xc000212300, 0xcfe560, 0xc000417170, 0xc00059d9e0, 0x0, 0xcfe560, 0xc000417170, 0xc00040a2c0, 0x14c)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:345 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002d7180, 0xd06460, 0xc0004fc480, 0xc000210400, 0xc0005a25d0, 0x11dcf10, 0x0, 0x0, 0x0)
        google.golang.org/[email protected]/server.go:1194 +0x50a
google.golang.org/grpc.(*Server).handleStream(0xc0002d7180, 0xd06460, 0xc0004fc480, 0xc000210400, 0x0)
        google.golang.org/[email protected]/server.go:1517 +0xcfb
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000202190, 0xc0002d7180, 0xd06460, 0xc0004fc480, 0xc000210400)
        google.golang.org/[email protected]/server.go:859 +0xa1
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:857 +0x204

Error: The terraform-provider-apisix plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Can you please help me?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.