-
Notifications
You must be signed in to change notification settings - Fork 207
79 lines (67 loc) · 2.11 KB
/
stop-localstack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT
name: Stop Localstack
env:
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }}
KEY_NAME: ${{ secrets.KEY_NAME }}
on:
workflow_call:
inputs:
region:
type: string
test_repo_name:
required: true
type: string
test_repo_branch:
required: true
type: string
terraform_assume_role:
type: string
github_sha:
required: true
type: string
s3_integration_bucket:
type: string
connection_port:
type: string
required: true
jobs:
StopLocalStack:
name: 'StopLocalStack'
runs-on: ubuntu-latest
if: ${{ always() }}
defaults:
run:
working-directory: terraform/ec2/localstack
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
with:
repository: ${{inputs.test_repo_name}}
ref: ${{inputs.test_repo_branch}}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ inputs.terraform_assume_role }}
aws-region: ${{ inputs.region }}
- name: Add IP to Security Group
id: add_ip
uses: aws/amazon-cloudwatch-agent/.github/workflows/add_ip_to_sg.yml
with:
port: ${{inputs.connection_port}}
- name: Copy state
run: aws s3 cp s3://${{inputs.s3_integration_bucket}}/integration-test/local-stack-terraform-state/${{inputs.github_sha}}/terraform.tfstate .
- name: Verify Terraform version
run: terraform --version
- name: Terraform init
run: terraform init
- name: Terraform destroy
run: terraform destroy -var="region=${{ inputs.region }}" --auto-approve
- name: Remove IP from Security Group
if: steps.add_ip.outcome == 'success'
uses: aws/amazon-cloudwatch-agent/.github/workflows/remove_ip_from_sg.yml
with:
ip: ${{ steps.add_ip.outputs.runner_ip }}
port: ${{inputs.connection_port}}