Skip to content

Commit 83fd1ae

Browse files
♻️ Generate _all_ Atmos Workflows (#661)
Co-authored-by: milldr <14060048+milldr@users.noreply.github.com>
1 parent 4bf4aa1 commit 83fd1ae

19 files changed

+1885
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Atmos Workflows
2+
3+
Atmos Workflows are used to automate deployment or destructions steps within the context of Atmos. Workflows
4+
combine multiple commands into one executable unit of work.
5+
6+
## Usage
7+
8+
Run any Workflow from the root of the directory by calling `atmos workflow -f filename`. Some workflow require a stack
9+
parameter, whereas others have the stack predetermined. Add a stack (where applicable) with `-s stack-name`
10+
11+
## Naming Convention
12+
13+
Workflow Jobs can have any name, but in order to maintain consistency, we have chosen to follow a pattern similar to
14+
Terraform commands.
15+
16+
**Note**: Not all Workflows include each of these commands. These are guidelines for naming any Workflow job.
17+
18+
### `vendor`
19+
20+
Use `vendor` to pull all the latest components for a given layer.
21+
22+
Example
23+
24+
```
25+
atmos workflow vendor -f baseline
26+
```
27+
28+
### `init`
29+
30+
Use `atmos workflow init -f {{ filename }}` to run any commands required before deployment.
31+
32+
Example
33+
34+
```
35+
atmos workflow init -f spacelift
36+
```
37+
38+
### `deploy`
39+
40+
Use `atmos workflow deploy -f {{ filename }}` to deploy all components for a given layer.
41+
42+
```
43+
atmos workflow deploy -f baseline
44+
```
45+
46+
Use `atmos workflow deploy/{{ component or group name }} -f {{ filename }}` to deploy a specific component or group of
47+
components
48+
49+
```
50+
atmos workflow deploy/vpc -f network
51+
atmos workflow deploy/tgw -f network
52+
```
53+
54+
### `all`
55+
56+
Use `atmos workflow all -f {{ filename }}` to run all steps together. This will execute all included jobs in the given
57+
Workflow in order.
58+
59+
For example,
60+
61+
```
62+
atmos workflow all -f spacelift
63+
```
64+
65+
66+
67+
## References
68+
69+
- [Atmos Workflows](https://atmos.tools/core-concepts/workflows/)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
workflows:
2+
all:
3+
description: run all workflows
4+
steps:
5+
- command: workflow deploy/accounts -f accounts
6+
- command: workflow deploy/account-settings -f accounts
7+
8+
deploy/organization:
9+
description: |
10+
Deploy the AWS Organization. This is required before finishing the root account requirements.
11+
steps:
12+
- command: terraform deploy account -target=aws_organizations_organization.this[0] -s core-gbl-root
13+
- command: aws ram enable-sharing-with-aws-organization
14+
type: shell
15+
16+
deploy/accounts:
17+
description: Deploys all AWS Organization accounts
18+
steps:
19+
- command: terraform apply account -s core-gbl-root
20+
- command: terraform deploy account-map -s core-gbl-root
21+
22+
deploy/account-settings:
23+
description: Apply AWS Account settings for best practices.
24+
steps:
25+
- command: terraform deploy account-settings -s core-gbl-artifacts
26+
- command: terraform deploy account-settings -s core-gbl-audit
27+
- command: terraform deploy account-settings -s core-gbl-auto
28+
- command: terraform deploy account-settings -s core-gbl-dns
29+
- command: terraform deploy account-settings -s core-gbl-identity
30+
- command: terraform deploy account-settings -s core-gbl-network
31+
- command: terraform deploy account-settings -s core-gbl-root
32+
- command: terraform deploy account-settings -s core-gbl-security
33+
- command: terraform deploy account-settings -s plat-gbl-dev
34+
- command: terraform deploy account-settings -s plat-gbl-prod
35+
- command: terraform deploy account-settings -s plat-gbl-sandbox
36+
- command: terraform deploy account-settings -s plat-gbl-staging
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
workflows:
2+
all:
3+
description: run all workflows
4+
steps:
5+
- command: workflow vendor -f addons
6+
- command: workflow deploy/all -f addons
7+
8+
vendor:
9+
description: Vendor addon components.
10+
steps:
11+
- command: workflow vendor -f addons/alb
12+
- command: workflow vendor -f addons/cognito
13+
- command: workflow vendor -f addons/kms
14+
- command: workflow vendor -f addons/lambda
15+
- command: workflow vendor -f addons/s3-bucket
16+
- command: workflow vendor -f addons/sns-topic
17+
- command: workflow vendor -f addons/sqs-queue
18+
- command: workflow vendor -f addons/ssm-parameters
19+
- command: workflow vendor -f addons/waf
20+
- command: workflow vendor -f addons/api-gateway
21+
- command: workflow vendor -f addons/kinesis-stream
22+
- command: workflow vendor -f addons/ses
23+
- command: workflow vendor -f addons/spa-s3-cloudfront
24+
- command: workflow vendor -f addons/ec2-instance
25+
26+
deploy/all:
27+
description: run all deploy workflows
28+
steps:
29+
- command: workflow deploy/alb -f addons
30+
- command: workflow deploy/cognito -f addons
31+
- command: workflow deploy/kms -f addons
32+
- command: workflow deploy/lambda -f addons
33+
- command: workflow deploy/s3-bucket -f addons
34+
- command: workflow deploy/sns-topic -f addons
35+
- command: workflow deploy/sqs-queue -f addons
36+
- command: workflow deploy/ssm-parameters -f addons
37+
- command: workflow deploy/waf -f addons
38+
- command: workflow deploy/api-gateway -f addons
39+
- command: workflow deploy/kinesis-stream -f addons
40+
- command: workflow deploy/ses -f addons
41+
- command: workflow deploy/spa-s3-cloudfront -f addons
42+
- command: workflow deploy/ec2-instance -f addons
43+
44+
deploy/alb:
45+
description: >-
46+
Deploy Alb Component.
47+
Please modify the stacks/workflows/addons/alb.yaml to customize
48+
steps:
49+
- command: workflow all -f addons/alb
50+
deploy/cognito:
51+
description: >-
52+
Deploy Cognito Component.
53+
Please modify the stacks/workflows/addons/cognito.yaml to customize
54+
steps:
55+
- command: workflow all -f addons/cognito
56+
deploy/kms:
57+
description: >-
58+
Deploy Kms Component.
59+
Please modify the stacks/workflows/addons/kms.yaml to customize
60+
steps:
61+
- command: workflow all -f addons/kms
62+
deploy/lambda:
63+
description: >-
64+
Deploy Lambda Component.
65+
Please modify the stacks/workflows/addons/lambda.yaml to customize
66+
steps:
67+
- command: workflow all -f addons/lambda
68+
deploy/s3-bucket:
69+
description: >-
70+
Deploy S3-Bucket Component.
71+
Please modify the stacks/workflows/addons/s3-bucket.yaml to customize
72+
steps:
73+
- command: workflow all -f addons/s3-bucket
74+
deploy/sns-topic:
75+
description: >-
76+
Deploy Sns-Topic Component.
77+
Please modify the stacks/workflows/addons/sns-topic.yaml to customize
78+
steps:
79+
- command: workflow all -f addons/sns-topic
80+
deploy/sqs-queue:
81+
description: >-
82+
Deploy Sqs-Queue Component.
83+
Please modify the stacks/workflows/addons/sqs-queue.yaml to customize
84+
steps:
85+
- command: workflow all -f addons/sqs-queue
86+
deploy/ssm-parameters:
87+
description: >-
88+
Deploy Ssm-Parameters Component.
89+
Please modify the stacks/workflows/addons/ssm-parameters.yaml to customize
90+
steps:
91+
- command: workflow all -f addons/ssm-parameters
92+
deploy/waf:
93+
description: >-
94+
Deploy Waf Component.
95+
Please modify the stacks/workflows/addons/waf.yaml to customize
96+
steps:
97+
- command: workflow all -f addons/waf
98+
deploy/api-gateway:
99+
description: >-
100+
Deploy Api-Gateway Component.
101+
Please modify the stacks/workflows/addons/api-gateway.yaml to customize
102+
steps:
103+
- command: workflow all -f addons/api-gateway
104+
deploy/kinesis-stream:
105+
description: >-
106+
Deploy Kinesis-Stream Component.
107+
Please modify the stacks/workflows/addons/kinesis-stream.yaml to customize
108+
steps:
109+
- command: workflow all -f addons/kinesis-stream
110+
deploy/ses:
111+
description: >-
112+
Deploy Ses Component.
113+
Please modify the stacks/workflows/addons/ses.yaml to customize
114+
steps:
115+
- command: workflow all -f addons/ses
116+
deploy/spa-s3-cloudfront:
117+
description: >-
118+
Deploy Spa-S3-Cloudfront Component.
119+
Please modify the stacks/workflows/addons/spa-s3-cloudfront.yaml to customize
120+
steps:
121+
- command: workflow all -f addons/spa-s3-cloudfront
122+
deploy/ec2-instance:
123+
description: >-
124+
Deploy Ec2-Instance Component.
125+
Please modify the stacks/workflows/addons/ec2-instance.yaml to customize
126+
steps:
127+
- command: workflow all -f addons/ec2-instance
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
workflows:
2+
all:
3+
description: run all workflows
4+
steps:
5+
- command: workflow init -f alerting
6+
- command: workflow vendor -f alerting
7+
- command: workflow deploy -f alerting
8+
9+
10+
init:
11+
description: Prompt to collect the OpsGenie API Key and write it to AWS SSM
12+
steps:
13+
- type: shell
14+
command: |-
15+
if [ $( AWS_PROFILE=acme-core-gbl-auto-admin chamber read opsgenie opsgenie_api_key ) ]; then
16+
echo "Found OpsGenie API Key, skipping init..."
17+
exit 0
18+
fi
19+
20+
echo "Please enter an OpsGenie API Key"
21+
stty -echo
22+
read -p "API Key: " -r API_KEY
23+
stty echo
24+
if [ -z "$API_KEY" ]
25+
then
26+
echo 'Inputs cannot be blank, please try again!'
27+
exit 0
28+
fi
29+
if ! [[ "$API_KEY" =~ "^[a-zA-Z0-9-]{36}$" ]]
30+
then
31+
echo "Invalid API Key"
32+
echo "HINT: The API key ID is displayed as a lower-case, 36-character alphanumeric value."
33+
exit 0
34+
fi
35+
AWS_PROFILE=acme-core-gbl-auto-admin chamber write opsgenie opsgenie_api_key "$API_KEY"
36+
37+
vendor:
38+
description: vendor dependencies
39+
steps:
40+
- command: vendor pull --component opsgenie-team
41+
42+
deploy:
43+
description: opsgenie
44+
steps:
45+
- command: terraform deploy opsgenie-team/app-team-1 -s core-gbl-auto
46+
- command: terraform deploy opsgenie-team/sre -s core-gbl-auto
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
workflows:
2+
all:
3+
steps:
4+
- command: workflow verify/github-oidc-providers -f app-on-ecs
5+
- command: workflow deploy/app-on-ecs -f app-on-ecs
6+
7+
verify/github-oidc-providers:
8+
description: |
9+
This workflow ensures all Github OIDC Provider Configuration deployed.
10+
steps:
11+
- command: workflow deploy/github-oidc-provider -f github
12+
13+
deploy/app-on-ecs:
14+
description: |
15+
This workflow deploys `app-on-ecs` stacks
16+
steps:
17+
- command: terraform deploy ecs-services/example-app-on-ecs -s plat-use1-sandbox
18+
- command: terraform deploy ecs-services/example-app-on-ecs/dev -s plat-use1-dev
19+
- command: terraform deploy ecs-services/example-app-on-ecs/qa1 -s plat-use1-dev
20+
- command: terraform deploy ecs-services/example-app-on-ecs/qa2 -s plat-use1-dev
21+
- command: terraform deploy ecs-services/example-app-on-ecs -s plat-use1-staging
22+
- command: terraform deploy ecs-services/example-app-on-ecs -s plat-use1-prod

0 commit comments

Comments
 (0)