forked from den-vasyliev/fwdays-sprint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodespace.bootstrap.sh
42 lines (31 loc) · 1.28 KB
/
codespace.bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Install OpenTofu
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sh -s -- --install-method standalone
# Instrall K9S to manage the cluster
curl -sS https://webi.sh/k9s | sh
# Initialize Tofu
cd tf-bootstrap
tofu init
# Prompt the user to enter the GitHub organization
read -p "Enter your GitHub organization: " TF_VAR_github_org
# Prompt the user to enter the GitHub repository
read -p "Enter your GitHub repository: " TF_VAR_github_repository
# Prompt the user to enter the GitHub token securely
read -s -p "Enter your GitHub token: " TF_VAR_github_token
echo
# Export GitHub organization, repository, and token as environment variables
export TF_VAR_github_org="$TF_VAR_github_org"
export TF_VAR_github_repository="$TF_VAR_github_repository"
export TF_VAR_github_token="$TF_VAR_github_token"
# Optionally, you can print the variables to verify (token is hidden)
echo "GitHub Organization: $TF_VAR_github_org"
echo "GitHub Repository: $TF_VAR_github_repository"
echo "GitHub Token: [HIDDEN]"
# Apply terrafrom configuration
tofu apply
# Create alias for k9s, kubectl and command-line autocompletion
#alias kk="EDITOR='code --wait' k9s"
#alias k=kubectl
#source <(kubectl completion zsh)
# Check your <GITHUB_REPO> repo for flux setup
# Check your local Kubernetes cluster