-
Notifications
You must be signed in to change notification settings - Fork 39
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
Terraform Provider: Kubeconfig as Base64 string #114
base: master
Are you sure you want to change the base?
Conversation
Accept kubeconfig as base64 string. When configuring the Harvester Terraform provider, the kubeconfig can either be given as path to a file, from which to read, or the contents can be supplied directly as base64 string. This allows for greater flexibility in supplying this sensitive data to the Terraform provider. related-to: harvester/harvester#6234 Signed-off-by: Moritz Röhrich <[email protected]>
Are we ok with the cluster user private key ( |
This is indeed a concern, but Terraform Enterprise or HCP Terraform are able to encrypt sensitive data before storing it: |
If it's up to the user to secure their statefile while using our provider, then I think we should document it somewhere. Normally, a provider would generate sensitive data as an |
This would help us with an issue we have getting this to work with Terraform cloud |
Looking forward to this as I think this would fix an issue we're encountering |
Document the risk of leaking sensitive information via the Terraform state files when supplying the kubeconfig as base64 encoded string. Signed-off-by: Moritz Röhrich <[email protected]>
I've added a warning in the documentation/example that informs the reader of the risk of leaking sensitive information via the Terraform state files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I can use kubeconfig
with base64 encode. Thanks.
FieldProviderKubeContext = "kubecontext" | ||
FieldProviderKubeConfig = "kubeconfig" | ||
FieldProviderKubeContext = "kubecontext" | ||
FieldProviderKubeConfigBase64 = "kubeconfig_base64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this is being used.
@@ -59,3 +68,16 @@ func NewClient(kubeConfig, kubeContext string) (*Client, error) { | |||
HarvesterNetworkClient: harvNetworkClient, | |||
}, nil | |||
} | |||
|
|||
func restConfigFromFile(kubeConfig, kubeContext string) (*rest.Config, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it make sense to move the homedir.Expand(d.Get(constants.FieldProviderKubeConfig).(string))
at
terraform-provider-harvester/internal/provider/provider.go
Lines 71 to 74 in 35e2902
kubeConfig, err := homedir.Expand(d.Get(constants.FieldProviderKubeConfig).(string)) | |
if err != nil { | |
return nil, diag.FromErr(err) | |
} |
Accept kubeconfig as base64 string.
When configuring the Harvester Terraform provider, the kubeconfig can either be given as path to a file, from which to read, or the contents can be supplied directly as base64 string.
This allows for greater flexibility in supplying this sensitive data to the Terraform provider.
related-to: harvester/harvester#6234