-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add terraform job to deal with the lifecycle of Terraform sources. Add helm job to deploy the aws-cli chart. Add AWS configuration file for AWS credentials.
- Loading branch information
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
region = eu-west-3 | ||
output = json | ||
|
||
[profile ippon-sandbox] | ||
aws_access_key_id = __AWS_ACCESS_KEY_ID__ | ||
aws_secret_access_key = __AWS_SECRET_ACCESS_KEY__ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
|
||
name: Deployment | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
jobs: | ||
terraform: | ||
name: Terraform | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: terraform | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: ~1.0 | ||
|
||
- name: Setup Terragrunt | ||
uses: autero1/action-terragrunt@v1.2.0 | ||
with: | ||
terragrunt_version: 0.40.2 | ||
|
||
- name: Set up AWS configuration file | ||
run: | | ||
sed -i "s/__AWS_ACCESS_KEY_ID__/${{ secrets.AWS_ACCESS_KEY_ID }}/g" ${{ github.workspace }}/.github/aws-config | ||
sed -i "s/__AWS_SECRET_ACCESS_KEY__/${{ secrets.AWS_SECRET_ACCESS_KEY }}/g" ${{ github.workspace }}/.github/aws-config | ||
echo "AWS_CONFIG_FILE=${{ github.workspace }}/.github/aws-config" >> $GITHUB_ENV | ||
- name: Terragrunt run-all init | ||
run: terragrunt run-all init | ||
|
||
- name: Terragrunt run-all plan | ||
run: terragrunt run-all plan | ||
|
||
- name: Terragrunt run-all apply | ||
if: github.ref == 'refs/heads/main' | ||
run: terragrunt run-all apply | ||
|
||
helm: | ||
name: Helm | ||
runs-on: ubuntu-latest | ||
needs: terraform | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup AWS CLI | ||
uses: unfor19/install-aws-cli-action@v1 | ||
with: | ||
version: 2 | ||
|
||
- name: Get kubernetes configuration file | ||
run: | | ||
aws eks --region eu-west-3 update-kubeconfig --name aws-eks-irsa | ||
- name: Helm install AWS CLI chart | ||
run: | | ||
helm upgrade \ | ||
--install \ | ||
--create-namespace \ | ||
--namespace aws-eks-irsa \ | ||
--set awsAccountId=${{ secrets.AWS_ACCOUNT_ID }} \ | ||
aws-cli helm/aws-cli |
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