Skip to content

Generate FortiGate YAML #1

Generate FortiGate YAML

Generate FortiGate YAML #1

name: Generate FortiGate YAML
on:
workflow_dispatch:
push:
branches:
- main
jobs:
generate-yaml:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1 # Change this to your preferred AWS region
- name: Install jq
run: sudo apt-get install jq
- name: Generate FortiGate YAML
run: |
#!/bin/bash
if [[ -n "$1" ]]; then
echo "Version: $1"
else
echo "Set version as ex. ./list_image_id.sh 7.2.2"
exit 1
fi
# Cleanup
rm $1_PAYG_json.txt
rm $1_BYOL_json.txt
rm $1_PAYG_yaml.txt
rm $1_BYOL_yaml.txt
# ... (rest of your script)
# Generate the FortiGate YAML
echo "AWSTemplateFormatVersion: '2010-09-09'" > FortiGateYAML-$1.yml
echo "Description: Returns a FortiGate Amazon Machine ID" >> FortiGateYAML-$1.yml
echo "Parameters:" >> FortiGateYAML-$1.yml
echo " Version:" >> FortiGateYAML-$1.yml
echo " Description: Security Gateway or Management Server version" >> FortiGateYAML-$1.yml
echo " Type: String" >> FortiGateYAML-$1.yml
echo " Default: $1" >> FortiGateYAML-$1.yml
echo " AllowedValues:" >> FortiGateYAML-$1.yml
# Add allowed values dynamically
for version in 7.4.2-BYOL 7.4.2-BYOL-ARM 7.2.6-BYOL 7.2.6-BYOL-ARM 7.0.13-BYOL 7.0.13-BYOL-ARM 6.4.14-BYOL 7.4.2-PAYG 7.4.2-PAYG-ARM 7.2.6-PAYG 7.2.6-PAYG-ARM 7.0.13-PAYG 7.0.13-PAYG-ARM 6.4.14-PAYG; do
echo " - $version" >> FortiGateYAML-$1.yml
done
echo "Mappings:" >> FortiGateYAML-$1.yml
echo " ConverterMap:" >> FortiGateYAML-$1.yml
# ... (rest of your script)
echo " eu-west-3:" >> FortiGateYAML-$1.yml
# ... (rest of your script)
shell: bash
- name: Commit and push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add FortiGateYAML-$1.yml
git commit -m "Generate FortiGate YAML for version $1"
git push
shell: bash