diff --git a/.github/workflows/crossplane.yaml b/.github/workflows/crossplane.yaml index 5a757ca9..77af52f4 100644 --- a/.github/workflows/crossplane.yaml +++ b/.github/workflows/crossplane.yaml @@ -7,6 +7,10 @@ on: service_name: required: true type: string + run_zip_lambda_workflow_step: + type: boolean + default: false + permissions: id-token: write @@ -53,6 +57,84 @@ jobs: uses: hashicorp/setup-terraform@v3 with: terraform_version: ~1.9 + + + + + + + + + + + + + + - name: Build lambdas + if: ${{inputs.run_zip_lambda_workflow_step == true}} + run: cd ${{ github.workspace }} && make lambda + env: + GITHUB_TOKEN: ${{ secrets.GB_TOKEN_PRIVATE }} + GOPRIVATE: "github.com/vimeda/*" + + - name: Upload Build Artifacts + if: ${{inputs.run_zip_lambda_workflow_step == 'true'}} + uses: actions/upload-artifact@v4 + with: + name: srv-lambdas + path: ${{ github.workspace }}/dist/* + + - uses: actions/download-artifact@v4 + id: download + if: ${{inputs.run_zip_lambda_workflow_step == 'true'}} + with: + name: srv-lambdas + path: ${{ github.workspace }}/dist + + - name: Display structure of downloaded files + if: ${{env.run_zip_lambda_workflow_step == true}} + run: ls -R + working-directory: ${{ steps.download.outputs.download-path }} + env: + run_zip_lambda_workflow_step: ${{ inputs.run_zip_lambda_workflow_step }} + + - name: Push all functions to Bucket + if: ${{env.run_zip_lambda_workflow_step == true}} + run: | + cd ${{ github.workspace }}/dist && ls + for file in "./"/*lambda.zip + do + filename=$(basename "$file" .zip) + function_name=${filename%_lambda} + aws s3 cp "$file" "s3://${{inputs.env}}-lykon-lambdas/${{ github.event.repository.name}}/$function_name.zip" + done + env: + run_zip_lambda_workflow_step: ${{ inputs.run_zip_lambda_workflow_step }} + + + + + + + + + + + + + + + + + + + + + + + + + - name: Terraform Init diff --git a/crossplane/main.tf b/crossplane/main.tf index df1f6199..5bd52471 100644 --- a/crossplane/main.tf +++ b/crossplane/main.tf @@ -55,4 +55,7 @@ resource "kubectl_manifest" "apply" { depends_on = [data.kubectl_file_documents.claims] for_each = toset(local.manifests_array) yaml_body = each.value # Apply each manifest from the array + lifecycle { + create_before_destroy = true # recreate the resource each time + } } diff --git a/crossplane/modify-claims.sh b/crossplane/modify-claims.sh index ed24fd72..d1da1f99 100755 --- a/crossplane/modify-claims.sh +++ b/crossplane/modify-claims.sh @@ -32,7 +32,7 @@ add_vpc_config() { if [[ "$env" == "staging" ]]; then config='{"vpcConfig":[{"securityGroupIds":["sg-03c24245575c1ebc0"],"subnetIds":["subnet-011cb6fe763310759","subnet-08deca209f9e46ebb","subnet-06e62ab1abfd70465"]}]}' elif [[ "$env" == "prod" ]]; then - config='{"vpcConfig":[{"securityGroupIds":["sg-03c24245575c1ebc0"],"subnetIds":["subnet-011cb6fe763310759","subnet-08deca209f9e46ebb","subnet-06e62ab1abfd70465"]}]}' + config='{"vpcConfig":[{"securityGroupIds":["sg-0c928b162190fd686"],"subnetIds":["subnet-0a03a55b3efec8bc5","subnet-074c6060a0d7ebe56","subnet-0ee3dbbbc8db2762e"]}]}' else echo "Error: Unsupported environment $env" exit 1