terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

feat(provider): add config_data_base64 parameter

Open yaroslavborbat opened this issue 1 year ago • 2 comments

Description

In some cases kubeconfig is passed to CICD via environment variables, but I would like to use this config when running the provider without creating a kubeconfig file.

For this purpose, the config_data_base64 paramerter is added to the provider configuration, which contains kubeconfig content in base64 format.

Usage examples:

provider "kubernetes" {
  config_data_base64 = "base64 config"
}

or export KUBE_CONFIG_DATA_BASE64="base64 config"

Acceptance tests

  • [ ] Have you added an acceptance test for the functionality being added?
  • [X] Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestProvider_configure_config_data_base64'
==> Checking that code complies with gofmt requirements...
go vet ./...
TF_ACC=1 go test "/home/yaroslavborbat/work/github/terraform-provider-kubernetes/kubernetes" -v -vet=off -run=TestProvider_configure_config_data_base64 -parallel 8 -timeout 3h
=== RUN   TestProvider_configure_config_data_base64
--- PASS: TestProvider_configure_config_data_base64 (0.01s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   0.034s
...

Release Note

Release note for CHANGELOG:

Added `config_data_base64` provider parameter.

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

yaroslavborbat avatar Mar 25 '24 11:03 yaroslavborbat

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Mar 25 '24 11:03 hashicorp-cla

Hi @yaroslavborbat and thanks for the contribution. I'd like to understand more about the need that sparked this change. At first glance this seems like a very particular use-case that only a limited amount of users would ever encounter.

Can you please share some details on:

  • why the kubeconfig file cannot be loaded from a file?
  • why is there a need to base64 encode the kubeconfig value?
  • what generates the kubeconfig payload to begin with?

Thanks for sharing the extra context.

alexsomesan avatar Apr 04 '24 13:04 alexsomesan

Hi @alexsomesan

In our case study we use a configuration file, to configure terraform provider. The file format is YAML. To avoid problems with escaping we use base64 encoding. Using kubeconfig file is not always convenient, in our case all settings necessary for the application are in one file. This simplifies the management of the application.

aleksey-su avatar Jan 05 '25 10:01 aleksey-su