Skip to content

Commit 91f94ab

Browse files
ishustavabarryib
authored andcommitted
feat: Kubeconfig file should not be world or group readable by default (terraform-aws-modules#1114)
Co-authored-by: Thierno IB. BARRY <[email protected]>
1 parent 2797956 commit 91f94ab

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
251251
| <a name="input_kubeconfig_aws_authenticator_command"></a> [kubeconfig\_aws\_authenticator\_command](#input\_kubeconfig\_aws\_authenticator\_command) | Command to use to fetch AWS EKS credentials. | `string` | `"aws-iam-authenticator"` | no |
252252
| <a name="input_kubeconfig_aws_authenticator_command_args"></a> [kubeconfig\_aws\_authenticator\_command\_args](#input\_kubeconfig\_aws\_authenticator\_command\_args) | Default arguments passed to the authenticator command. Defaults to [token -i $cluster\_name]. | `list(string)` | `[]` | no |
253253
| <a name="input_kubeconfig_aws_authenticator_env_variables"></a> [kubeconfig\_aws\_authenticator\_env\_variables](#input\_kubeconfig\_aws\_authenticator\_env\_variables) | Environment variables that should be used when executing the authenticator. e.g. { AWS\_PROFILE = "eks"}. | `map(string)` | `{}` | no |
254+
| <a name="input_kubeconfig_file_permission"></a> [kubeconfig\_file\_permission](#input\_kubeconfig\_file\_permission) | File permission of the Kubectl config file containing cluster configuration saved to `config_output_path.` | `string` | `"0600"` | no |
254255
| <a name="input_kubeconfig_name"></a> [kubeconfig\_name](#input\_kubeconfig\_name) | Override the default name used for items kubeconfig. | `string` | `""` | no |
255256
| <a name="input_manage_aws_auth"></a> [manage\_aws\_auth](#input\_manage\_aws\_auth) | Whether to apply the aws-auth configmap file. | `bool` | `true` | no |
256257
| <a name="input_manage_cluster_iam_resources"></a> [manage\_cluster\_iam\_resources](#input\_manage\_cluster\_iam\_resources) | Whether to let the module manage cluster IAM resources. If set to false, cluster\_iam\_role\_name must be specified. | `bool` | `true` | no |

kubectl.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ resource "local_file" "kubeconfig" {
22
count = var.write_kubeconfig && var.create_eks ? 1 : 0
33
content = local.kubeconfig
44
filename = substr(var.config_output_path, -1, 1) == "/" ? "${var.config_output_path}kubeconfig_${var.cluster_name}" : var.config_output_path
5-
file_permission = "0644"
5+
file_permission = var.kubeconfig_file_permission
66
directory_permission = "0755"
77
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ variable "config_output_path" {
3838
default = "./"
3939
}
4040

41+
variable "kubeconfig_file_permission" {
42+
description = "File permission of the Kubectl config file containing cluster configuration saved to `config_output_path.`"
43+
type = string
44+
default = "0600"
45+
}
46+
4147
variable "write_kubeconfig" {
4248
description = "Whether to write a Kubectl config file containing the cluster configuration. Saved to `config_output_path`."
4349
type = bool

0 commit comments

Comments
 (0)