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

Eks kubernetes terraform template #219

Open
Al-Pragliola opened this issue May 14, 2024 · 0 comments
Open

Eks kubernetes terraform template #219

Al-Pragliola opened this issue May 14, 2024 · 0 comments

Comments

@Al-Pragliola
Copy link
Contributor

check for nils in

.spec.kubernetes.awsAuth.additionalAccounts
.spec.kubernetes.awsAuth.users
.spec.kubernetes.awsAuth.roles

to avoid template: main.auto.tfvars.tpl:56:24: executing "main.auto.tfvars.tpl" at <.spec.kubernetes.awsAuth.additionalAccounts>: map has no entry for key "additionalAccounts"

{{- if hasKeyAny .spec.kubernetes "awsAuth" }}
    {{- if gt (len .spec.kubernetes.awsAuth.additionalAccounts) 0 }}
eks_map_accounts = {{ toJson .spec.kubernetes.awsAuth.additionalAccounts }}
    {{- end }}

    {{- if gt (len .spec.kubernetes.awsAuth.users) 0 }}
        {{- $users := list }}

        {{- range $u := .spec.kubernetes.awsAuth.users }}
            {{- $currUser := dict "username" $u.username "userarn" $u.userarn "groups" $u.groups }}
            {{- $users = append $users $currUser }}
        {{- end }}
eks_map_users = {{ toPrettyJson $users | join ","}}
    {{- end }}

    {{- if gt (len .spec.kubernetes.awsAuth.roles) 0 }}
        {{- $roles := list }}

        {{- range $r := .spec.kubernetes.awsAuth.roles }}
            {{- $currRole := dict "username" $r.username "rolearn" $r.rolearn "groups" $r.groups }}
            {{- $roles = append $roles $currRole }}
        {{- end }}
eks_map_roles = {{ toPrettyJson $roles | join "," }}
    {{- end }}
{{- end }}
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

No branches or pull requests

1 participant