aws_waf_ce is null #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "WAF on K8s Apply" | |
on: | |
push: | |
branches: | |
- deploy-waf-k8s | |
pull_request: | |
jobs: | |
terraform_infra: | |
name: "Deploy AWS Infra" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./aws/infra | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Setup Terraform Backend | |
id: backend | |
run: | | |
cat > backend.tf << EOF | |
terraform { | |
cloud { | |
organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
workspaces { | |
name = "${{ secrets.TF_CLOUD_WORKSPACE_INFRA }}" | |
} | |
} | |
} | |
EOF | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
if: github.event_name == 'pull_request' | |
run: terraform plan -no-color -input=false | |
continue-on-error: true | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`\n | |
${process.env.PLAN} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/deploy-waf-k8s' && github.event_name == 'push' | |
run: terraform apply -auto-approve -input=false | |
terraform_eks: | |
name: "Deploy AWS EKS" | |
runs-on: ubuntu-latest | |
needs: terraform_infra | |
defaults: | |
run: | |
working-directory: ./aws/eks-cluster | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Setup Terraform Backend | |
id: backend | |
run: | | |
cat > backend.tf << EOF | |
terraform { | |
cloud { | |
organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
workspaces { | |
name = "${{ secrets.TF_CLOUD_WORKSPACE_EKS }}" | |
} | |
} | |
} | |
EOF | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
if: github.event_name == 'pull_request' | |
run: terraform plan -no-color -input=false | |
continue-on-error: true | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`\n | |
${process.env.PLAN} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/deploy-waf-k8s' && github.event_name == 'push' | |
run: terraform apply -auto-approve -input=false | |
terraform_bookinfo: | |
name: "Deploy Bookinfo App" | |
runs-on: ubuntu-latest | |
needs: terraform_eks | |
defaults: | |
run: | |
working-directory: ./shared/booksinfo/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Setup Terraform Backend | |
id: backend | |
run: | | |
cat > backend.tf << EOF | |
terraform { | |
cloud { | |
organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
workspaces { | |
name = "${{ secrets.TF_CLOUD_WORKSPACE_BOOKINFO }}" | |
} | |
} | |
} | |
EOF | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
if: github.event_name == 'pull_request' | |
run: terraform plan -no-color -input=false | |
continue-on-error: true | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`\n | |
${process.env.PLAN} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/deploy-waf-k8s' && github.event_name == 'push' | |
run: terraform apply -auto-approve -input=false | |
terraform_ce: | |
name: "Deploy EKS CE" | |
runs-on: ubuntu-latest | |
needs: terraform_bookinfo | |
defaults: | |
run: | |
working-directory: ./aws/eks-cluster/ce-deployment | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Setup Terraform Backend | |
id: backend | |
run: | | |
cat > backend.tf << EOF | |
terraform { | |
cloud { | |
organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
workspaces { | |
name = "${{ secrets.TF_CLOUD_WORKSPACE_CE }}" | |
} | |
} | |
} | |
EOF | |
- name: Setup Configmap | |
id: configmap | |
run: | | |
cat > configmap.tf << EOF | |
resource "kubectl_manifest" "configmap" { | |
yaml_body = <<YAML | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: vpm-cfg | |
namespace: ves-system | |
data: | |
config.yaml: | | |
Vpm: | |
# CHANGE ME | |
ClusterName: ${{ secrets.TF_VAR_site_name }} | |
ClusterType: ce | |
Config: /etc/vpm/config.yaml | |
DisableModules: ["recruiter"] | |
# CHANGE ME | |
Latitude: ${{ secrets.TF_CE_LATITUDE }} | |
# CHANGE ME | |
Longitude: ${{ secrets.TF_CE_LONGITUDE }} | |
MauriceEndpoint: https://register.ves.volterra.io | |
MauricePrivateEndpoint: https://register-tls.ves.volterra.io | |
PrivateNIC: eth0 | |
SkipStages: ["osSetup", "etcd", "kubelet", "master", "voucher", "workload", "controlWorkload"] | |
# CHANGE ME | |
Token: ${{ secrets.TF_CE_TOKEN }} | |
CertifiedHardware: k8s-minikube-voltmesh | |
YAML | |
} | |
EOF | |
- name: Terraform fmt | |
id: format | |
run: | | |
pwd | |
terraform fmt | |
cat configmap.tf | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
if: github.event_name == 'pull_request' | |
run: terraform plan -no-color -input=false | |
continue-on-error: true | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`\n | |
${process.env.PLAN} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/deploy-waf-k8s' && github.event_name == 'push' | |
run: terraform apply -auto-approve -input=false | |
terraform_xc: | |
name: "Deploy F5XC WAF" | |
runs-on: ubuntu-latest | |
needs: terraform_ce | |
defaults: | |
run: | |
working-directory: ./xc | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Setup Terraform Backend | |
id: backend | |
run: | | |
cat > backend.tf << EOF | |
terraform { | |
cloud { | |
organization = "${{ secrets.TF_CLOUD_ORGANIZATION }}" | |
workspaces { | |
name = "${{ secrets.TF_CLOUD_WORKSPACE_XC }}" | |
} | |
} | |
} | |
EOF | |
echo "${{secrets.P12}}" | base64 -d > api.p12 | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Terraform Plan | |
id: plan | |
if: github.event_name == 'pull_request' | |
run: terraform plan -no-color -input=false | |
continue-on-error: true | |
- uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` | |
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`\n | |
${process.env.PLAN} | |
\`\`\` | |
</details> | |
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) | |
- name: Terraform Plan Status | |
if: steps.plan.outcome == 'failure' | |
run: exit 1 | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/deploy-waf-k8s' && github.event_name == 'push' | |
run: terraform apply -auto-approve -input=false | |
env: | |
TF_VAR_site_name: ${{ secrets.TF_VAR_site_name }} |