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

KONG_ADMIN_TOKEN ignored #135

Closed
tlu-rs opened this issue Sep 13, 2021 · 1 comment · Fixed by #140
Closed

KONG_ADMIN_TOKEN ignored #135

tlu-rs opened this issue Sep 13, 2021 · 1 comment · Fixed by #140

Comments

@tlu-rs
Copy link

tlu-rs commented Sep 13, 2021

With v6.2.0 and v6.0.2, KONG_ADMIN_TOKEN is ignored. As a workaround we set KONG_API_KEY=${KONG_ADMIN_TOKEN} to get this to work.

Versions

Terraform v1.0.4
Kong Provider v6.2.0 and v6.0.2
Kong Enterprise v2.5.0.1

Terraform Configuration Files

export KONG_ADMIN_TOKEN=<redacted>

provider "kong" {
  kong_admin_uri = "https://${data.terraform_remote_state.kong.outputs.api_addr}/${var.domain}"
}

resource "kong_service" "service" {
  host     = "kong-test.example.com"
  name     = "kong-test"
  path     = "/"
  port     = 443
  protocol = "https"
}

Error

│ Error: failed to create kong service: &{<nil> 0xc000045180 <nil> 0xc0001dd480 <nil> 0xc0001dd400 0xc0001dd4e0 0xc000045168 0xc0001dd440 0xc0000451a0 0xc000045170 <nil> <nil> 0xc000045190 [] <nil> <nil> []} error: HTTP status 401 (message: "Invalid credentials. Token or User credentials required")

Workaround

export KONG_ADMIN_TOKEN=<redacted>
export KONG_API_KEY=${KONG_ADMIN_TOKEN}

Shouldn't this be opt.AdminToken instead of opt.APIKey like this?

	if opt.AdminToken != "" {
		headers = append(headers, fmt.Sprintf("kong-admin-token:%v", opt.AdminToken))
	}
kevholditch-f3 added a commit that referenced this issue Oct 20, 2021
kevholditch pushed a commit that referenced this issue Oct 20, 2021
@kevholditch-f3
Copy link
Contributor

Thanks for raising, this has been fixed in version v6.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants