Skip to content

Add a way to set auth provider on rancher2_custom_user_token #2113

@github-actions

Description

@github-actions

This is the tracking issue for #2108

Please add labels indicating the release versions eg. 'release/v14'

Please add comments for user issues which this issue addresses.

Description copied from PR:

Addresses #2102

Description

Add field auth_provider on resource rancher2_custom_user_token to generate token for ActiveDirectory user or others. If not set, default is local.
I change DoUserLogin function to use v3 API first, instead to continue to use v1. On my Rancher (2.13.1), the v1 api is still here, so it never use the new v3 API. It seems the v3 api support more auth provider like ping or custom_oidc.

Testing

I have compiled the binaire and put it on ~/.terraform.d/plugins/terraform.local/local/rancher2/0.1.1/linux_amd64/terraform-provider-rancher2.
You need to have Rancher with ActiveDirectory Auth provider setted (or other)

Then:

provider "rancher2" {
  api_url    = "https://rancher.local.domain"
  insecure   = true
  token_key      = "xxx"
}

resource "rancher2_custom_user_token" "test_ad" {
  auth_provider = "activedirectory"
  username = "user1"
  password = "xxx"
  description = "foo token"
  ttl = 0
}

To finish:

terraform apply

Not a breaking change.

Metadata

Metadata

Assignees

Labels

internal/trackingThis is an issue tracking release of a PR across multiple verisonsrelease/v14Targets release v14.x correlating to Rancher's v2.14.x

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions