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

Automated testing for AWS infrastructure #6

Closed
wants to merge 99 commits into from
Closed
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
4779044
- created testing pipeline
Jan 21, 2024
281b617
add auto-approve flag
Jan 21, 2024
fbccb2d
- use testing env vars from env instead of file
Jan 21, 2024
d509965
- save tfstate as artifact
Jan 21, 2024
603a4d0
- Use scripts instead of tofu cli
Jan 22, 2024
ff68d7b
- separate deployment of aws from k8s
Jan 22, 2024
38b8a96
- fix vars
Jan 22, 2024
67bb6fe
- fix vars
Jan 22, 2024
377feca
- fix artifact path
Jan 22, 2024
9fc45a9
- fix output string
Jan 22, 2024
8c9b1a5
- trying fix for state output
Jan 22, 2024
d29bcb4
- fix newline issue
Jan 22, 2024
d263f7d
- fix memory overflow in script
Jan 22, 2024
0e4d6fc
- just create a new comment
Jan 22, 2024
8d47a9d
- trying fix for comment size
Jan 22, 2024
504f9cb
- fixing the fix
Jan 22, 2024
6c3e841
- set output to file
Jan 22, 2024
3db88e4
show plans
Jan 22, 2024
ccadafe
show state
Jan 22, 2024
9a2e304
change action to download files from other workflow
Jan 22, 2024
f2e3a0a
- set falkordb with password
Jan 22, 2024
cf2fafe
fix plan target
AviAvni Jan 22, 2024
a1bb20f
- update aws action version
Jan 22, 2024
88f98ca
remove comment
Jan 22, 2024
7be3ead
fix cluster name
Jan 22, 2024
25bb8be
merge into single job
Jan 22, 2024
f8f29f1
fix artifacts path
Jan 22, 2024
d60abd0
- Env vars not show in logs
Jan 22, 2024
3d67f62
save state as artifact
Jan 22, 2024
7ee86d3
change hash code
Jan 22, 2024
560a76a
fix create tfvars
Jan 22, 2024
cb13129
fix create tfvars
Jan 22, 2024
0b156d6
fix hash path
Jan 22, 2024
adc5767
add tofu cache
Jan 22, 2024
d99517d
fix plan path
Jan 22, 2024
6e469f0
fix plan name parameter
Jan 22, 2024
752b467
fix plan file
Jan 22, 2024
d96022f
skip init if cache misses
Jan 22, 2024
6da7b73
fail if python tests did not pass
Jan 23, 2024
5095050
change name to name_and_random
Jan 23, 2024
372b882
fixing deploy and destroy infra
Jan 24, 2024
201a458
remove profile var
Jan 24, 2024
2c08785
assume role as variable
AviAvni Jan 24, 2024
c232d2f
eks auth role extract to variable
AviAvni Jan 24, 2024
6e12008
use variable
AviAvni Jan 24, 2024
15f55f9
use variable
AviAvni Jan 24, 2024
6df3698
Update testing-plan-aws-infra.yaml
AviAvni Jan 24, 2024
309dc46
add password
AviAvni Jan 24, 2024
924e843
fix secret
AviAvni Jan 24, 2024
6eeab52
move to secret
AviAvni Jan 24, 2024
9a67b0f
cancel prev action
AviAvni Jan 24, 2024
6e3cb45
fix script
AviAvni Jan 24, 2024
62ce519
update versions
AviAvni Jan 25, 2024
7bcd3e6
fixing delete aws resources dependency
Jan 25, 2024
7dc1595
- add assume role
Jan 25, 2024
1745e6a
Merge branch 'main' into feature/testing-pipeline
AviAvni Jan 25, 2024
3d35724
fix state out
Jan 25, 2024
a23c839
fix cache dir
Jan 25, 2024
2ee110c
fix cache dir
Jan 25, 2024
6ece9ca
fix argument
Jan 25, 2024
d8bdea7
remove -auto-approve
Jan 25, 2024
ce3d61c
fix args position
Jan 25, 2024
7652708
update checkout version
Jan 25, 2024
4dd2d4b
- fixing apply k8s
Jan 25, 2024
1bf7a31
fix dir
Jan 25, 2024
6564ab7
plan and apply k8s separately
Jan 25, 2024
f7fb8e0
fix typo
Jan 25, 2024
7bb5ea2
use terraform vars correctly
Jan 25, 2024
b3571d0
env vars path
Jan 25, 2024
b02438c
copy vars
Jan 25, 2024
eb0cc80
changing scripts location and scripts
Jan 26, 2024
b130064
fix path
Jan 26, 2024
11c1318
fix path
Jan 26, 2024
14e1f70
allow workflow_dispatch events
Jan 26, 2024
fd6427a
add vars to destroy
Jan 26, 2024
0862ab5
add pr_number for workflow dispatch
Jan 26, 2024
1e44931
remove vars from apply
Jan 26, 2024
78b26f9
set variables from aws output
Jan 26, 2024
9ff8e37
Separate modules plan, apply, destroy
Jan 26, 2024
d0de9cb
fix vars
Jan 26, 2024
65ebd0c
fix variables
Jan 27, 2024
eabda52
add s3 var
Jan 27, 2024
c5d2b3a
add tenant_name var
Jan 27, 2024
cac51bd
add tenant_name
Jan 27, 2024
5442c73
fix variables
Jan 28, 2024
7b8b1f9
remove s3 bucket data block
Jan 28, 2024
f705756
add tofu init for each module
Jan 28, 2024
d6900bd
add plan to k8s
Jan 28, 2024
78e4c1c
check tfvars location
Jan 28, 2024
5e176d7
fix script name and location
Jan 28, 2024
d9b96d0
remove unused vars
Jan 28, 2024
463cf95
remove "
Jan 28, 2024
2ef2b19
output raw var
Jan 28, 2024
e4541a3
fix vars
Jan 28, 2024
e9f418a
checking falkordb host
Jan 28, 2024
bda7b71
fix set host
Jan 28, 2024
525bad1
set host
Jan 28, 2024
877f8b9
fix host
Jan 28, 2024
39bc87e
fixing env vars
Jan 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions .github/workflows/testing-apply-aws-infra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: TESTING Apply AWS infrastructure

on:
pull_request_review:
types: [submitted]
workflow_dispatch:
inputs:
pr_number:
description: "Pull request number"
required: true

defaults:
run:
working-directory: ./scripts

env:
PR_NUMBER: ${{github.event.pull_request.number }}
PLAN_WORKFLOW_NAME: testing-plan-aws-infra.yaml
# TF_CACHE_DIR: ${{ github.workspace }}/tofu/.terraform

Comment on lines +16 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dynamic setting of PR_NUMBER using GitHub context is a smart approach to ensure that the workflow can access the PR number across different jobs and steps. However, the commented-out TF_CACHE_DIR environment variable suggests there was an intention to use a Terraform plugin cache directory, which is not utilized in the current workflow. Consider either implementing caching for Terraform plugins to improve performance or removing this commented-out variable to clean up the code.

jobs:
apply-test-aws-k8s-infra:
if: github.event.review.state == 'approved' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment: testing
steps:
- uses: actions/checkout@v4

- name: Set PR_NUMBER env variable
if: github.event_name == 'workflow_dispatch'
run: |
# If event is workflow_dispatch, use the event.workflow_dispatch.inputs.pr_number
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_ENV

- name: Init AWS credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ vars.TF_VAR_REGION }}

- name: Set up Tofu
uses: opentofu/[email protected]
with:
tofu_wrapper: false

# - name: Create Terraform Plugin Cache Dir
# run: mkdir --parents ${{ env.TF_CACHE_DIR }}

# - name: Cache OpenTofu plugins
# uses: actions/cache@v2
# id: cache_opentofu_plugins
# with:
# path: ${{ env.TF_CACHE_DIR }}
# key: tofu-${{hashFiles('./tofu/.terraform.lock.hcl')}}

- name: Get artifacts
uses: dawidd6/action-download-artifact@v3
with:
workflow: ${{ env.PLAN_WORKFLOW_NAME }}
pr: ${{ env.PR_NUMBER }}
workflow_conclusion: success
name: artifacts-${{ env.PR_NUMBER }}
path: artifacts

- name: Copy artifacts
working-directory: ./artifacts
run: |
cp plan-aws.out ../tofu/aws/plan-aws
cp terraform.tfvars ../tofu/terraform.tfvars

- name: Apply AWS infrastructure
id: apply_infrastructure
timeout-minutes: 20
continue-on-error: true
working-directory: ./tofu/aws
run: |
tofu init
tofu apply -auto-approve -state-out ../../state/state-aws plan-aws

- name: Set AWS infra output variables
continue-on-error: true
working-directory: ./tofu/aws
run: |
echo "TF_VAR_falkordb_eks_cluster_name=$(tofu output -state=../../state/state-aws -raw falkordb_eks_cluster_name)" >> $GITHUB_ENV
echo "TF_VAR_falkordb_s3_backup_name=$(tofu output -state=../../state/state-aws -raw falkordb_s3_backup_name)" >> $GITHUB_ENV
echo "TF_VAR_falkordb_eks_cluster_oidc_issuer_url=$(tofu output -state=../../state/state-aws -raw falkordb_eks_cluster_oidc_issuer_url)" >> $GITHUB_ENV
echo "TF_VAR_falkordb_eks_cluster_oidc_issuer_arn=$(tofu output -state=../../state/state-aws -raw falkordb_eks_cluster_oidc_issuer_arn)" >> $GITHUB_ENV
echo "TF_VAR_falkordb_eks_cluster_role_arn=$(tofu output -state=../../state/state-aws -raw falkordb_eks_cluster_role_arn)" >> $GITHUB_ENV
echo "TF_VAR_falkordb_eks_cluster_endpoint=$(tofu output -state=../../state/state-aws -raw falkordb_eks_cluster_endpoint)" >> $GITHUB_ENV
echo "TF_VAR_falkordb_eks_cluster_certificate_autority=$(tofu output -state=../../state/state-aws -raw falkordb_eks_cluster_certificate_autority)" >> $GITHUB_ENV
Comment on lines +72 to +91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The steps for applying AWS infrastructure and setting output variables are well-structured. However, using continue-on-error: true might mask failures that should halt the workflow. Consider carefully whether you want the workflow to continue in the face of errors during these steps, as this could lead to partial or incorrect infrastructure deployment.


- name: Archive AWS target state
uses: actions/upload-artifact@v4
with:
name: state-aws-${{ env.PR_NUMBER }}
path: state/state-aws
if-no-files-found: error

- name: Get EKS cluster credentials
id: get_eks_credentials
if: steps.apply_infrastructure.outcome == 'success'
continue-on-error: true
run: |
./aws_update_kubeconfig.sh testing-cluster-${{ env.PR_NUMBER }} ${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}

- name: Check connection to EKS cluster
if: steps.get_eks_credentials.outcome == 'success'
continue-on-error: true
run: |
kubectl get nodes

- name: Apply k8s module
if: steps.get_eks_credentials.outcome == 'success'
id: apply_k8s_module
timeout-minutes: 20
continue-on-error: true
working-directory: ./tofu/k8s
run: |
tofu init
tofu plan -out=local-k8s -var-file=../terraform.tfvars -var "assume_role_arn=${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}" -var "falkordb_password=${{ secrets.TF_VAR_FALKORDB_PASSWORD }}"
tofu apply -auto-approve -state-out ../../state/state-k8s local-k8s

- name: Archive K8S target state
uses: actions/upload-artifact@v4
with:
name: state-k8s-${{ env.PR_NUMBER }}
path: state/state-k8s
if-no-files-found: error

- name: Get FalkorDB endpoint
if: steps.apply_k8s_module.outcome == 'success'
continue-on-error: true
id: lb
run: |
FALKORDB_HOST = kubectl get svc -n falkordb falkordb-redis -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
# If FALKORDB_HOST is empty, wait 30 seconds and try again
if [ -z "$FALKORDB_HOST" ]; then
sleep 30
FALKORDB_HOST = kubectl get svc -n falkordb falkordb-redis -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
fi

# If FALKORDB_HOST is still empty, exit with error
if [ -z "$FALKORDB_HOST" ]; then
echo "FALKORDB_HOST is empty"
echo "$(kubectl get svc -n falkordb falkordb-redis)"
exit 1
fi

echo "host=$FALKORDB_HOST" >> $GITHUB_ENV

- name: Run python tests
id: python_tests
if: steps.apply_k8s_module.outcome == 'success'
working-directory: .
continue-on-error: true
run: |
FALKORDB_HOST=${{ steps.lb.outputs.host }}
FALKORDB_PORT=6379
FALKORDB_PASSWORD=${{ secrets.TF_VAR_FALKORDB_PASSWORD }}
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pytest

- name: Destroy K8S infrastructure
if: always()
working-directory: ./tofu/k8s
run: tofu destroy -auto-approve -state ../../state/state-k8s -var-file=../terraform.tfvars -var "assume_role_arn=${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}" -var "falkordb_password=${{ secrets.TF_VAR_FALKORDB_PASSWORD }}"

- name: Destroy AWS infrastructure
if: always()
working-directory: ./tofu/aws
run: tofu destroy -auto-approve -state ../../state/state-aws -var-file=../terraform.tfvars -var "assume_role_arn=${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}" -var "eks_auth_role=${{ secrets.TF_VAR_EKS_AUTH_ROLE }}"

- name: Fail if tests did not pass
if: always()
run: |
# Check if python tests conclusion is success
if [ ${{ steps.python_tests.conclusion }} != 'success' ]; then
exit 1
fi
108 changes: 108 additions & 0 deletions .github/workflows/testing-plan-aws-infra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: TESTING Plan AWS infrastructure

on:
pull_request:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

defaults:
run:
working-directory: ./scripts

env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# TF_CACHE_DIR: ${{ github.workspace }}/tofu/.terraform

jobs:
plan-infra:
runs-on: ubuntu-latest
environment: testing
steps:
- uses: actions/checkout@v4

- name: Init AWS credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ vars.TF_VAR_REGION }}

- name: Set up testing environment variables
env:
name: testing-cluster-${{ env.PR_NUMBER }}
tenant_name: testing-tenant-${{ env.PR_NUMBER }}
region: ${{ vars.TF_VAR_REGION }}
k8s_version: ${{ vars.TF_VAR_K8S_VERSION }}
k8s_instance_type: ${{ vars.TF_VAR_K8S_INSTANCE_TYPE }}
k8s_node_count: ${{ vars.TF_VAR_K8S_NODE_COUNT }}
k8s_node_min_count: ${{ vars.TF_VAR_K8S_NODE_MIN_COUNT }}
k8s_node_max_count: ${{ vars.TF_VAR_K8S_NODE_MAX_COUNT }}
backup_retention_period: ${{ vars.TF_VAR_BACKUP_RETENTION_PERIOD }}
falkordb_version: v4.0.3
falkordb_cpu: ${{ vars.TF_VAR_FALKORDB_CPU }}
falkordb_memory: ${{ vars.TF_VAR_FALKORDB_MEMORY }}
persistance_size: ${{ vars.TF_VAR_PERSISTANCE_SIZE }}
falkordb_replicas: ${{ vars.TF_VAR_FALKORDB_REPLICAS }}
grafana_admin_password: ${{ vars.TF_VAR_GRAFANA_ADMIN_PASSWORD }}
backup_schedule: ${{ vars.TF_VAR_BACKUP_SCHEDULE }}
# falkordb_domain: ${{ vars.TF_VAR_FALKORDB_DOMAIN }}

# If we add these here, they will be exported in the tfvars file
# assume_role_arn: ${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}
# eks_auth_role: ${{ secrets.TF_VAR_EKS_AUTH_ROLE }}
# falkordb_hosted_zone_id: ${{ secrets.TF_VAR_FALKORDB_HOSTED_ZONE_ID }}
# falkordb_password: ${{ secrets.TF_VAR_FALKORDB_PASSWORD }}
run: |
./create_tfvars_from_env.sh
mkdir -p ${GITHUB_WORKSPACE}/artifacts
cp ../tofu/terraform.tfvars ${GITHUB_WORKSPACE}/artifacts/terraform.tfvars

- name: Set up Tofu
uses: opentofu/[email protected]

# - name: Create Tofu Plugin Cache Dir
# run: |
# echo 'plugin_cache_dir="$HOME/.terraform.d/plugin-cache"' >~/.terraformrc
# mkdir --parents ~/.terraform.d/plugin-cache

# - name: Cache OpenTofu modules
# uses: actions/cache@v2
# id: cache_opentofu_plugins
# with:
# path: ${{ env.TF_CACHE_DIR }}
# key: tofu-${{hashFiles('./tofu/.terraform.lock.hcl')}}

# - name: Init infrastructure
# # if: steps.cache_opentofu_plugins.outputs.cache-hit != 'true'
# run: ./tofu_init.sh

# - name: Run tests
# run: ./tofu_test.sh

- name: Plan AWS module
id: plan_aws
working-directory: ./tofu/aws
run: |
tofu init
tofu test
tofu plan -out ../../local-aws -var "assume_role_arn=${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}" -var "eks_auth_role=${{ secrets.TF_VAR_EKS_AUTH_ROLE }}"
cp ../../local-aws ${GITHUB_WORKSPACE}/artifacts/plan-aws.out

- name: Plan K8S module
id: plan_k8s
working-directory: ./tofu/k8s
run: |
tofu init
tofu test
tofu plan -out ../../local-k8s -var "falkordb_s3_backup_name='test-backup-bucket-s3'" -var "assume_role_arn=${{ secrets.TF_VAR_ASSUME_ROLE_ARN }}" -var "falkordb_password=${{ secrets.TF_VAR_FALKORDB_PASSWORD }}" -var "falkordb_eks_cluster_oidc_issuer_url=''" -var "falkordb_eks_cluster_oidc_issuer_arn=''" -var "falkordb_eks_cluster_endpoint=''" -var "falkordb_eks_cluster_certificate_autority=dGVzdA=="
cp ../../local-k8s ${GITHUB_WORKSPACE}/artifacts/plan-k8s.out

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ env.PR_NUMBER }}
path: artifacts
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
terraform.tfvars
terraform.tfstate
terraform.tfstate.backup
local
local
.venv
tofu/__tests__/__pycache__
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ Scripts to help work with this repository
5. tofu_delete_workspace.sh: Delete workspace.
6. tofu_list_workspace.sh: List available workspaces.
7. tofu_plan.sh: Generate execution plan to be deployed.
8. tofu_apply.sh: Deploy the plan to the cloud provider.
9. tofu_destroy.sh: Delete the deployment from the cloud provider.
10. tofu_output.sh: Show deployment output.
11. aws_update_kubeconfig.sh: Update kubectl config.
12. kubectl_connect_falkordb_master.sh: Port forward into the FalkorDB master node.
13. kubectl_connect_grafana.sh: Port forward into the grafana gui.
14. kubectl_connect_prometheus.sh: Port forward into the prometheus gui.
15. kubectl_connect_alertmanager.sh: Port forward into the alert manager gui.
8. tofu_plan_aws.sh: Generate execution plan to be deployed for the AWS target.
9. tofu_plan_k8s.sh: Generate execution plan to be deployed for the K8S target.
10. tofu_apply.sh: Deploy the plan to the cloud provider.
11. tofu_apply_aws.sh: Deploy the AWS target to the cloud provider.
12. tofu_apply_k8s.sh: Deploy the K8S target to the cloud provider.
13. tofu_destroy.sh: Delete the deployment from the cloud provider.
14. tofu_output.sh: Show deployment output.
15. tofu_show.sh: Show the state configuration.
16. tofu_test.sh: Run Tofu tests.
17. aws_update_kubeconfig.sh: Update kubectl config.
18. kubectl_connect_falkordb_master.sh: Port forward into the FalkorDB master node.
19. kubectl_connect_grafana.sh: Port forward into the grafana gui.
20. kubectl_connect_prometheus.sh: Port forward into the prometheus gui.
21. kubectl_connect_alertmanager.sh: Port forward into the alert manager gui.

# Tofu

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FalkorDB==1.0.1
pytest==6.2.4
2 changes: 1 addition & 1 deletion scripts/aws_update_kubeconfig.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aws eks update-kubeconfig --name $1
aws eks update-kubeconfig --name $1 --role-arn $2
20 changes: 20 additions & 0 deletions scripts/create_tfvars_from_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
echo "name=\"$name\"
tenant_name=\"$name\"
region=\"$region\"
k8s_version=\"$k8s_version\"
k8s_instance_type=\"$k8s_instance_type\"
k8s_node_count=\"$k8s_node_count\"
k8s_node_min_count=\"$k8s_node_min_count\"
k8s_node_max_count=\"$k8s_node_max_count\"
backup_retention_period=\"$backup_retention_period\"
falkordb_version=\"$falkordb_version\"
falkordb_cpu=\"$falkordb_cpu\"
falkordb_memory=\"$falkordb_memory\"
persistance_size=\"$persistance_size\"
falkordb_replicas=\"$falkordb_replicas\"
grafana_admin_password=\"$grafana_admin_password\"
backup_schedule=\"$backup_schedule\"
# falkordb_domain=\"$falkordb_domain\"
" > ../tofu/terraform.tfvars
cp ../tofu/terraform.tfvars ../tofu/aws/terraform.tfvars
cp ../tofu/terraform.tfvars ../tofu/k8s/terraform.tfvars
5 changes: 5 additions & 0 deletions scripts/tofu_apply_aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PLAN_PATH=local-aws
if [ -n "$1" ]; then
PLAN_PATH=$1
fi
cd ../tofu && tofu apply -state-out=../state/state-aws -auto-approve $PLAN_PATH
5 changes: 5 additions & 0 deletions scripts/tofu_apply_k8s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PLAN_PATH=local-k8s
if [ -n "$1" ]; then
PLAN_PATH=$1
fi
cd ../tofu && tofu apply -state-out=../state/state-k8s $PLAN_PATH
1 change: 1 addition & 0 deletions scripts/tofu_plan_aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ../tofu && tofu plan -target=module.aws -out=local-aws
1 change: 1 addition & 0 deletions scripts/tofu_plan_k8s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ../tofu && tofu plan -target=module.k8s -out=local-k8s
5 changes: 5 additions & 0 deletions scripts/tofu_show.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
STATE_PATH=local
if [ -n "$1" ]; then
STATE_PATH=$1
fi
cd ../tofu && tofu show -no-color $STATE_PATH
1 change: 1 addition & 0 deletions scripts/tofu_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ../tofu && tofu test
Loading
Loading