Skip to content

Commit 802da6a

Browse files
committed
may whitespace aid not hinder comprehension
1 parent b74a784 commit 802da6a

File tree

4 files changed

+6
-32
lines changed

4 files changed

+6
-32
lines changed

docs/guides/permissions/aws/main.tf

-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ provider "aws" {
1515
resource "aws_iam_user" "task" {
1616
name = "task"
1717
}
18-
1918
resource "aws_iam_access_key" "task" {
2019
user = aws_iam_user.task.name
2120
}
22-
2321
resource "aws_iam_user_policy" "task" {
2422
name = aws_iam_user.task.name
2523
user = aws_iam_user.task.name
@@ -77,7 +75,6 @@ data "aws_iam_policy_document" "task" {
7775
output "aws_access_key_id" {
7876
value = aws_iam_access_key.task.id
7977
}
80-
8178
output "aws_secret_access_key" {
8279
value = aws_iam_access_key.task.secret
8380
sensitive = true

docs/guides/permissions/az/main.tf

-9
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,25 @@ terraform {
66
}
77

88
provider "azuread" {}
9-
109
provider "azurerm" {
1110
features {}
1211
}
1312

1413
data "azuread_client_config" "current" {}
15-
1614
data "azurerm_subscription" "current" {}
1715

1816
resource "azuread_application" "task" {
1917
display_name = "task"
2018
owners = [data.azuread_client_config.current.object_id]
2119
}
22-
2320
resource "azuread_application_password" "task" {
2421
application_object_id = azuread_application.task.object_id
2522
}
26-
2723
resource "azuread_service_principal" "task" {
2824
application_id = azuread_application.task.application_id
2925
app_role_assignment_required = false
3026
owners = [data.azuread_client_config.current.object_id]
3127
}
32-
3328
resource "azurerm_role_definition" "task" {
3429
name = azuread_application.task.display_name
3530
scope = data.azurerm_subscription.current.id
@@ -88,7 +83,6 @@ resource "azurerm_role_definition" "task" {
8883
]
8984
}
9085
}
91-
9286
resource "azurerm_role_assignment" "task" {
9387
name = azurerm_role_definition.task.name
9488
principal_id = azuread_service_principal.task.object_id
@@ -99,15 +93,12 @@ resource "azurerm_role_assignment" "task" {
9993
output "azure_subscription_id" {
10094
value = basename(data.azurerm_subscription.current.id)
10195
}
102-
10396
output "azure_tenant_id" {
10497
value = data.azurerm_subscription.current.tenant_id
10598
}
106-
10799
output "azure_client_id" {
108100
value = azuread_application.task.application_id
109101
}
110-
111102
output "azure_client_secret" {
112103
value = azuread_application_password.task.value
113104
sensitive = true

docs/guides/permissions/gcp/main.tf

-3
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ data "google_project" "current" {}
1717
resource "google_service_account" "task" {
1818
account_id = "task-service-account"
1919
}
20-
2120
resource "google_service_account_key" "task" {
2221
service_account_id = google_service_account.task.email
2322
}
24-
2523
resource "google_project_iam_binding" "task" {
2624
project = data.google_project.current.project_id
2725
role = "projects/${data.google_project.current.project_id}/roles/${google_project_iam_custom_role.task.role_id}"
2826
members = ["serviceAccount:${google_service_account.task.email}"]
2927
}
30-
3128
resource "google_project_iam_custom_role" "task" {
3229
role_id = replace("${google_service_account.task.account_id}-role", "-", "_")
3330
title = replace("${google_service_account.task.account_id}-role", "-", "_")
+6-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
#!/bin/bash
22
set -euxo pipefail
3-
SERVER="$(
4-
kubectl config view --raw --flatten --output \
5-
jsonpath='{.clusters[0].cluster.server}'
6-
)"
7-
AUTHORITY="$(
8-
kubectl config view --raw --flatten --output \
9-
jsonpath='{.clusters[0].cluster.certificate-authority-data}'
10-
)"
11-
SECRET="$(
12-
kubectl get serviceaccount task --output \
13-
jsonpath="{.secrets[0].name}"
14-
)"
15-
TOKEN="$(
16-
kubectl get secret "$SECRET" --output \
17-
jsonpath="{.data.token}" | base64 --decode
18-
)"
3+
SERVER="$(kubectl config view --raw --flatten --output jsonpath='{.clusters[0].cluster.server}')"
4+
AUTHORITY="$(kubectl config view --raw --flatten --output jsonpath='{.clusters[0].cluster.certificate-authority-data}')"
5+
SECRET="$(kubectl get serviceaccount task --output jsonpath="{.secrets[0].name}")"
6+
TOKEN="$(kubectl get secret "$SECRET" --output jsonpath="{.data.token}" | base64 --decode)"
197
export KUBECONFIG="$(mktemp)"
208
{
219
kubectl config set-cluster cluster --server="https://$SERVER"
@@ -24,4 +12,5 @@ export KUBECONFIG="$(mktemp)"
2412
kubectl config set-context cluster --cluster=cluster --user=task
2513
kubectl config use-context cluster
2614
} >/dev/null
27-
cat "$KUBECONFIG" && rm "$KUBECONFIG"
15+
cat "$KUBECONFIG"
16+
rm "$KUBECONFIG"

0 commit comments

Comments
 (0)