diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f6cd46e..1d241df4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -104,7 +104,7 @@ jobs: fail-fast: false matrix: include: - - ELK_VERSION: 7.2.1 + - ELK_VERSION: 7.6.1 KIBANA_TYPE: KibanaTypeLogzio MAKELOGS_VERSION: '@elastic/makelogs@4.5.0' steps: @@ -126,11 +126,12 @@ jobs: env: ELK_VERSION: ${{ matrix.ELK_VERSION }} KIBANA_TYPE: ${{ matrix.KIBANA_TYPE }} - KIBANA_URI: 'https://app-eu.logz.io' + KIBANA_URI: 'https://app-eu.logz.io/kibana-7-6' ELASTIC_SEARCH_PATH: '/kibana/elasticsearch/logzioCustomerKibanaIndex' MAKELOGS_VERSION: ${{ matrix.MAKELOGS_VERSION }} KIBANA_USERNAME: ${{ secrets.KIBANA_USERNAME }} KIBANA_PASSWORD: ${{ secrets.KIBANA_PASSWORD }} + LOGZ_URL: 'https://app-eu.logz.io' LOGZ_CLIENT_ID: ${{ secrets.LOGZ_CLIENT_ID }} LOGZ_MFA_SECRET: ${{ secrets.LOGZ_MFA_SECRET }} diff --git a/go.mod b/go.mod index 18e321e9..ecb893d0 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.4.15 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/containerd/continuity v0.0.0-20200928162600-f2cc35102c2a // indirect - github.com/ewilde/go-kibana v0.0.0-20210312090537-1c39d951b736 + github.com/ewilde/go-kibana v0.0.0-20210325142727-7a2d527c3f8c github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect github.com/hashicorp/terraform-plugin-sdk v1.16.0 github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2 diff --git a/go.sum b/go.sum index db6dc5bb..0c472ebc 100644 --- a/go.sum +++ b/go.sum @@ -103,6 +103,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ewilde/go-kibana v0.0.0-20210312090537-1c39d951b736 h1:GxY1w9631ijxBzWjiPrPsRSTCQv/JNc0a39RTMbx4/M= github.com/ewilde/go-kibana v0.0.0-20210312090537-1c39d951b736/go.mod h1:QqYl0aCvJWhxdEEk/fleOzj9syUnx63B7DSaT4MEDrU= +github.com/ewilde/go-kibana v0.0.0-20210325142727-7a2d527c3f8c h1:Y58NU4Mpsu8eQj4CYHeZv5DKgcOy8pNucBfRfag7bKE= +github.com/ewilde/go-kibana v0.0.0-20210325142727-7a2d527c3f8c/go.mod h1:/uEUlwXJ0qwq4vizCl0WAmIJY65nG8YKvY3VldPR6NY= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= @@ -356,6 +358,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ulikunitz/xz v0.5.7 h1:YvTNdFzX6+W5m9msiYg/zpkSURPPtOlzbqYjrFn7Yt4= github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -616,6 +619,7 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/kibana/provider.go b/kibana/provider.go index b0063f94..71c3b8c9 100644 --- a/kibana/provider.go +++ b/kibana/provider.go @@ -2,11 +2,12 @@ package kibana import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/terraform" "log" "os" "sync" + "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/ewilde/go-kibana" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) @@ -181,9 +182,14 @@ func getAuthHandler(config *kibana.Config, d *schema.ResourceData) kibana.Authen } func getLogzioAuthHandler(config *kibana.Config, d *schema.ResourceData) kibana.AuthenticationHandler { + url := config.KibanaBaseUri + if v := os.Getenv(kibana.EnvLogzURL); v != "" { + url = v + } + return &kibana.LogzAuthenticationHandler{ Auth0Uri: "https://logzio.auth0.com", - LogzUri: config.KibanaBaseUri, + LogzUri: url, ClientId: d.Get("logzio_client_id").(string), UserName: d.Get("kibana_username").(string), Password: d.Get("kibana_password").(string), diff --git a/vendor/github.com/ewilde/go-kibana/.travis.yml b/vendor/github.com/ewilde/go-kibana/.travis.yml index 6c0d007c..a9d6a821 100644 --- a/vendor/github.com/ewilde/go-kibana/.travis.yml +++ b/vendor/github.com/ewilde/go-kibana/.travis.yml @@ -1,13 +1,13 @@ --- language: go go: -- 1.9 +- 1.16 services: - docker env: matrix: - ELK_VERSION=5.5.3 KIBANA_TYPE=KibanaTypeVanilla ELASTIC_PACK= MAKELOGS_VERSION=makelogs@4.0.3 - - ELK_VERSION=7.2.1 KIBANA_TYPE=KibanaTypeLogzio KIBANA_URI=https://app-eu.logz.io ELASTIC_SEARCH_PATH=/kibana/elasticsearch/logzioCustomerKibanaIndex LOGZ_IO_ACCOUNT_ID_1=16533 LOGZ_IO_ACCOUNT_ID_2=14942 + - ELK_VERSION=7.6.1 KIBANA_TYPE=KibanaTypeLogzio KIBANA_URI=https://app-eu.logz.io/kibana-7-6 ELASTIC_SEARCH_PATH=/kibana/elasticsearch/logzioCustomerKibanaIndex LOGZ_URL=https://app-eu.logz.io LOGZ_IO_ACCOUNT_ID_1=16533 LOGZ_IO_ACCOUNT_ID_2=14942 - ELK_VERSION=6.2.1 KIBANA_TYPE=KibanaTypeVanilla MAKELOGS_VERSION=makelogs@4.0.3 - ELK_VERSION=6.4.1 KIBANA_TYPE=KibanaTypeVanilla MAKELOGS_VERSION=makelogs@4.0.3 - ELK_VERSION=7.3.1 KIBANA_TYPE=KibanaTypeVanilla MAKELOGS_VERSION=@elastic/makelogs@4.5.0 diff --git a/vendor/github.com/ewilde/go-kibana/README.md b/vendor/github.com/ewilde/go-kibana/README.md index f6ffa555..3184fa4e 100644 --- a/vendor/github.com/ewilde/go-kibana/README.md +++ b/vendor/github.com/ewilde/go-kibana/README.md @@ -138,9 +138,10 @@ env ELK_VERSION=6.2.1 KIBANA_TYPE=KibanaTypeVanilla make |:----------------|:----------------------------------------| | ELK_VERSION| Version of ELK to run while test against logzio | | KIBANA_TYPE| Always KibanaTypeLogzio| -| KIBANA_URI| Your logz.io base uri i.e. https://app-eu.logz.io | +| KIBANA_URI| Your logz.io base uri i.e. https://app-eu.logz.io/kibana-7-6 | | ELASTIC_SEARCH_PATH| Always /kibana/elasticsearch/logzioCustomerKibanaIndex for logz.io| | LOGZ_CLIENT_ID| Obtained for the POST data call to https://logzio.auth0.com/oauth/ro. Use chrome developer tools when you login to logz.io to obtain this. | +| LOGZ_URL| *Optional* The base URL to Logz.io, i.e https://app-eu.logz.io. Defaults to KIBANA_URI or https://app-eu.logz.io (in that order)| |LOGZ_MFA_SECRET| _Optional_ One time password secret, if account requires MFA. | | KIBANA_USERNAME| Your logz.io username| | KIBANA_PASSWORD| Your logz.io password| diff --git a/vendor/github.com/ewilde/go-kibana/go.mod b/vendor/github.com/ewilde/go-kibana/go.mod index 684e7bf4..5ddd2462 100644 --- a/vendor/github.com/ewilde/go-kibana/go.mod +++ b/vendor/github.com/ewilde/go-kibana/go.mod @@ -27,7 +27,7 @@ require ( github.com/satori/go.uuid v1.2.0 github.com/sirupsen/logrus v1.3.0 // indirect github.com/smartystreets/goconvey v1.6.4 // indirect - github.com/stretchr/testify v1.3.0 + github.com/stretchr/testify v1.7.0 github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119 golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect diff --git a/vendor/github.com/ewilde/go-kibana/go.sum b/vendor/github.com/ewilde/go-kibana/go.sum index 3ba288c3..38553359 100644 --- a/vendor/github.com/ewilde/go-kibana/go.sum +++ b/vendor/github.com/ewilde/go-kibana/go.sum @@ -33,6 +33,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -56,6 +57,7 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4 h1:BN/Nyn2nWMoqGRA7G7paDNDqTXE30mXGqzzybrfo05w= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= @@ -66,11 +68,14 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119 h1:YyPWX3jLOtYKulBR6AScGIs74lLrJcgeKRwcbAuQOG4= github.com/xlzd/gotp v0.0.0-20181030022105-c8557ba2c119/go.mod h1:/nuTSlK+okRfR/vnIPqR89fFKonnWPiZymN5ydRJkX8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -82,9 +87,14 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa h1:lqti/xP+yD/6zH5TqEwx2MilNIJY5Vbc6Qr8J3qyPIQ= golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/vendor/github.com/ewilde/go-kibana/kibana_client.go b/vendor/github.com/ewilde/go-kibana/kibana_client.go index 7d88cf19..f8d69175 100644 --- a/vendor/github.com/ewilde/go-kibana/kibana_client.go +++ b/vendor/github.com/ewilde/go-kibana/kibana_client.go @@ -21,6 +21,7 @@ const EnvKibanaVersion = "ELK_VERSION" const EnvKibanaIndexId = "KIBANA_INDEX_ID" const EnvKibanaType = "KIBANA_TYPE" const EnvKibanaDebug = "KIBANA_DEBUG" +const EnvLogzURL = "LOGZ_URL" const EnvLogzClientId = "LOGZ_CLIENT_ID" const EnvLogzMfaSecret = "LOGZ_MFA_SECRET" const DefaultKibanaUri = "http://localhost:5601" diff --git a/vendor/github.com/ewilde/go-kibana/testing.go b/vendor/github.com/ewilde/go-kibana/testing.go index 961f9f87..2425a250 100644 --- a/vendor/github.com/ewilde/go-kibana/testing.go +++ b/vendor/github.com/ewilde/go-kibana/testing.go @@ -114,6 +114,10 @@ func createLogzAuthenticationHandler() *LogzAuthenticationHandler { agent := gorequest.New() agent.Debug = os.Getenv(EnvKibanaDebug) != "" uri := os.Getenv(EnvKibanaUri) + if v := os.Getenv(EnvLogzURL); v != "" { + uri = v + } + if uri == "" { uri = "https://app-eu.logz.io" } diff --git a/vendor/modules.txt b/vendor/modules.txt index dd5275c7..922e143b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -83,7 +83,7 @@ github.com/emirpasic/gods/lists/arraylist github.com/emirpasic/gods/trees github.com/emirpasic/gods/trees/binaryheap github.com/emirpasic/gods/utils -# github.com/ewilde/go-kibana v0.0.0-20210312090537-1c39d951b736 +# github.com/ewilde/go-kibana v0.0.0-20210325142727-7a2d527c3f8c github.com/ewilde/go-kibana # github.com/fatih/color v1.7.0 github.com/fatih/color