Skip to content

Commit ebffc7f

Browse files
authored
Bump commons (#57)
* Initial bump * Further fixes * Fixes * Fixing things in action.yaml * Bumping README version * Typo in action * Missing correct commons version
1 parent 701c770 commit ebffc7f

File tree

2 files changed

+205
-107
lines changed

2 files changed

+205
-107
lines changed

README.md

Lines changed: 129 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ If you would like to deploy a backend app/service, check out our other actions:
2323
# Need help or have questions?
2424
This project is supported by [Bitovi, A DevOps consultancy](https://www.bitovi.com/services/devops-consulting).
2525

26-
You can **get help or ask questions** on our:
27-
28-
- [Discord Community](https://discord.gg/zAHn4JBVcX)
26+
You can **get help or ask questions** on our [Discord channel](https://discord.gg/zAHn4JBVcX)! Come hang out with us; We love discussing solutions!
2927

3028
Or, you can hire us for training, consulting, or development. [Set up a free consultation](https://www.bitovi.com/services/devops-consulting).
3129

@@ -37,6 +35,24 @@ Or, you can hire us for training, consulting, or development. [Set up a free con
3735
- `ST2_AUTH_USERNAME`
3836
- `ST2_AUTH_PASSWORD`
3937

38+
:warning: In the latest release, some variables were replaced. Old one will not work.
39+
40+
| Old variable | Replaced By |
41+
| - | - |
42+
| aws_extra_tags | aws_additional_tags |
43+
| aws_ec2_instance_profile | aws_ec2_iam_instance_profile |
44+
| aws_ec2_instance_vol_size | aws_ec2_instance_root_vol_size |
45+
| aws_domain_name | aws_r53_domain_name |
46+
| aws_sub_domain_name | aws_r53_sub_domain_name |
47+
| aws_root_domain_deploy | aws_r53_root_domain_deploy |
48+
| aws_cert_arn | aws_r53_cert_arn |
49+
| aws_create_root_cert | aws_r53_create_root_cert |
50+
| aws_create_sub_cert | aws_r53_create_sub_cert |
51+
| aws_no_cert | aws_r53_enable_cert :warning: |
52+
53+
> :warning: `aws_no_cert` has the opossite value of `aws_r53_enable_cert`. Cert lookup is set to `true` by default, and won't fail if it can't find any.
54+
<br/>
55+
4056
## Example usage
4157

4258
Create a Github Action Workflow `.github/workflow/deploy-st2.yaml` with the following to build on push to the `main` branch.
@@ -79,56 +95,117 @@ This will create the following resources in AWS:
7995
## Customizing
8096

8197
### Inputs
98+
1. [Action Defaults](#action-defaults-inputs)
99+
2. [AWS Configuration](#aws-configuration-inputs)
100+
4. [EC2](#ec2-instance-config)
101+
5. [Stackstorm inputs](#stackstorm-inputs)
102+
6. [Stack Management](#stack-management)
103+
7. [Domains and certificates](#domains-and-certificates)
104+
8. [VPC](#vpc-configuration)
105+
9. [Advanced Options](#advanced-options)
106+
107+
### Outputs
108+
1. [Action Outpus](#action-outputs)
109+
82110

83111
The following inputs can be used as `steps.with` keys:
112+
<br/>
113+
<br/>
114+
115+
#### **Action defaults Inputs**
116+
| Name | Type | Description |
117+
|------------------|---------|------------------------------------|
118+
| `checkout` | Boolean | Set to `false` if the code is already checked out. (Default is `true`). |
119+
<hr/>
120+
<br/>
121+
122+
#### **AWS Configuration Inputs**
123+
| Name | Type | Description |
124+
|------------------|---------|------------------------------------|
125+
| `aws_access_key_id` | String | AWS access key ID |
126+
| `aws_secret_access_key` | String | AWS secret access key |
127+
| `aws_session_token` | String | AWS session token |
128+
| `aws_default_region` | String | AWS default region. Defaults to `us-east-1` |
129+
| `aws_resource_identifier` | String | Set to override the AWS resource identifier for the deployment. Defaults to `${GITHUB_ORG_NAME}-${GITHUB_REPO_NAME}-${GITHUB_BRANCH_NAME}`. |
130+
| `aws_additional_tags` | JSON | Add additional tags to the terraform [default tags](https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider), any tags put here will be added to all provisioned resources. |
131+
<hr/>
132+
<br/>
133+
134+
#### **EC2 Instance config**
135+
| Name | Type | Description |
136+
|------------------|---------|------------------------------------|
137+
| `aws_ec2_instance_type` | String | The AWS IAM instance type to use. Default is `t3.medium`. See [this list](https://aws.amazon.com/ec2/instance-types/) for reference. |
138+
| `aws_ec2_instance_root_vol_size` | Integer | Define the volume size (in GiB) for the root volume on the AWS Instance. Defaults to `8`. |
139+
| `aws_ec2_instance_root_vol_preserve` | Boolean | Set this to true to avoid deletion of root volume on termination. Defaults to `false`. |
140+
| `aws_ec2_security_group_name` | String | The name of the EC2 security group. Defaults to `SG for ${aws_resource_identifier} - EC2`. |
141+
| `aws_ec2_iam_instance_profile` | String | The AWS IAM instance profile to use for the EC2 instance. Will create one if none provided with the name `aws_resource_identifier`. |
142+
| `aws_ec2_create_keypair_sm` | Boolean | Generates and manages a secret manager entry that contains the public and private keys created for the ec2 instance. Defaults to `false`. |
143+
| `aws_ec2_instance_public_ip` | Boolean | Add a public IP to the instance or not. Defaults to `true`. |
144+
| `aws_ec2_additional_tags` | JSON | Add additional tags to the terraform [default tags](https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider), any tags put here will be added to ec2 provisioned resources.|
145+
<hr/>
146+
<br/>
147+
148+
#### **Stackstorm inputs**
149+
| Name | Type | Description |
150+
|------------------|---------|------------------------------------|
151+
| `st2_auth_username` | String | Username used by StackStorm standalone authentication. Set as a secret in GH Actions. |
152+
| `st2_auth_password` | String | Password used by StackStorm standalone authentication. Set as a secret in GH Actions. |
153+
| `st2_packs` | String | Comma separated list of packs to install. If you modify this option, be sure to also include `st2` in the list. Defaults to `"st2"` |
154+
| `st2_ansible_extra_vars_file` | String | Relative path from project root to Ansible vars file. If you'd like to adjust more advanced configuration; st2 version, st2.conf, RBAC, chatops, auth, etc. See https://github.com/stackStorm/ansible-st2#variables for the full list of settings. The Ansible vars will take higher precedence over the GHA inputs. |
155+
| `st2_version_tag` | String | Stackstorm Ansible release tag to use. See https://github.com/StackStorm/ansible-st2/releases |
156+
<hr/>
157+
<br/>
158+
159+
#### **Stack Management**
160+
| Name | Type | Description |
161+
|------------------|---------|------------------------------------|
162+
| `tf_stack_destroy` | Boolean | Set to `true` to destroy the stack - Will delete the `elb logs bucket` after the destroy action runs. |
163+
| `tf_state_file_name` | String | Change this to be anything you want to. Carefull to be consistent here. A missing file could trigger recreation, or stepping over destruction of non-defined objects. Defaults to `tf-state-aws`. |
164+
| `tf_state_file_name_append` | String | Appends a string to the tf-state-file. Setting this to `unique` will generate `tf-state-aws-unique`. (Can co-exist with `tf_state_file_name`) |
165+
| `tf_state_bucket` | String | AWS S3 bucket name to use for Terraform state. See [note](#s3-buckets-naming) |
166+
| `tf_state_bucket_destroy` | Boolean | Force purge and deletion of S3 bucket defined. Any file contained there will be destroyed. `tf_stack_destroy` must also be `true`. Default is `false`. |
167+
<hr/>
168+
<br/>
169+
170+
#### **Domains and certificates**
171+
| Name | Type | Description |
172+
|------------------|---------|------------------------------------|
173+
| `aws_r53_domain_name` | String | Define the root domain name for the application. e.g. bitovi.com'. |
174+
| `aws_r53_sub_domain_name` | String | Define the sub-domain part of the URL. Defaults to `aws_resource_identifier`. |
175+
| `aws_r53_root_domain_deploy` | Boolean | Deploy application to root domain. Will create root and www records. Default is `false`. |
176+
| `aws_r53_enable_cert` | Boolean | Set this to true if you wish to manage certificates through AWS Certificate Manager with Terraform. **See note**. Default is `false`. |
177+
| `aws_r53_cert_arn` | String | Define the certificate ARN to use for the application. **See note**. |
178+
| `aws_r53_create_root_cert` | Boolean | Generates and manage the root cert for the application. **See note**. Default is `false`. |
179+
| `aws_r53_create_sub_cert` | Boolean | Generates and manage the sub-domain certificate for the application. **See note**. Default is `false`. |
180+
| `aws_r53_additional_tags` | JSON | Add additional tags to the terraform [default tags](https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider), any tags put here will be added to R53 provisioned resources.|
181+
<hr/>
182+
<br/>
183+
184+
#### **VPC configuration**
185+
| Name | Type | Description |
186+
|------------------|---------|------------------------------------|
187+
| `aws_vpc_create` | Boolean | Define if a VPC should be created. Defaults to `false`. |
188+
| `aws_vpc_name` | String | Define a name for the VPC. Defaults to `VPC for ${aws_resource_identifier}`. |
189+
| `aws_vpc_cidr_block` | String | Define Base CIDR block which is divided into subnet CIDR blocks. Defaults to `10.0.0.0/16`. |
190+
| `aws_vpc_public_subnets` | String | Comma separated list of public subnets. Defaults to `10.10.110.0/24`|
191+
| `aws_vpc_private_subnets` | String | Comma separated list of private subnets. If no input, no private subnet will be created. Defaults to `<none>`. |
192+
| `aws_vpc_availability_zones` | String | Comma separated list of availability zones. Defaults to `aws_default_region+<random>` value. If a list is defined, the first zone will be the one used for the EC2 instance. |
193+
| `aws_vpc_id` | String | **Existing** AWS VPC ID to use. Accepts `vpc-###` values. |
194+
| `aws_vpc_subnet_id` | String | **Existing** AWS VPC Subnet ID. If none provided, will pick one. (Ideal when there's only one). |
195+
| `aws_vpc_enable_nat_gateway` | Boolean | Adds a NAT gateway for each public subnet. Defaults to `false`. |
196+
| `aws_vpc_single_nat_gateway` | Boolean | Toggles only one NAT gateway for all of the public subnets. Defaults to `false`. |
197+
| `aws_vpc_external_nat_ip_ids` | String | **Existing** comma separated list of IP IDs if reusing. (ElasticIPs). |
198+
| `aws_vpc_additional_tags` | JSON | Add additional tags to the terraform [default tags](https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider), any tags put here will be added to vpc provisioned resources.|
199+
<hr/>
200+
<br/>
84201

85-
| Name | Type | Default | Description |
86-
|------------------|---------|-------------|------------------------------------|
87-
| `checkout` | bool | `true` | Specifies if this action should checkout the code (i.e. whether or not to run the `uses: actions/checkout@v3` action prior to deploying so that the deployment has access to the repo files) |
88-
| **AWS configuration** |
89-
| `aws_access_key_id` | string | | AWS access key ID (Required) |
90-
| `aws_secret_access_key` | string | | AWS secret access key (Required) |
91-
| `aws_session_token` | string | | AWS session token, if you're using temporary credentials |
92-
| `aws_default_region` | string | `us-east-1` | AWS default region (Required) |
93-
| `aws_resource_identifier` | string | `${org}-${repo}-${branch}` | Auto-generated by default so it's unique for org/repo/branch. Set to override with custom naming the unique AWS resource identifier for the deployment. |
94-
| `aws_extra_tags` | json | | A list of additional tags that will be included on created resources. Example: `{"key1": "value1", "key2": "value2"}`. |
95-
| **EC2 Instance config** |
96-
| `aws_ec2_instance_type` | string | `t2.medium` | The AWS EC2 instance type. |
97-
| `aws_ec2_instance_profile` | string | | [The AWS IAM instance profile](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) to use for the EC2 instance. Use if you want to pass an AWS role with specific permissions granted to the instance |
98-
| `aws_ec2_create_keypair_sm` | bool | | Generates and manage a secret manager entry that contains the public and private keys created for the ec2 instance. |
99-
| `aws_ec2_instance_vol_size` | string | 8 | Define the volume size (in GiB) for the root volume on the AWS Instance. |
100-
| `aws_ec2_additional_tags` | string | | Add additional tags to the terraform [default tags](https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider), any tags put here will be added to ec2 provisioned resources.|
101-
| `infrastructure_only` | bool | `false` | Set to true to provision infrastructure (with Terraform) but skip the app deployment (with ansible) |
102-
| **StackStorm configuration** |
103-
| `st2_auth_username` | string | | Username used by StackStorm standalone authentication. Set as a secret in GH Actions. |
104-
| `st2_auth_password` | string | | Password used by StackStorm standalone authentication. Set as a secret in GH Actions. |
105-
| `st2_packs` | string |`"st2"` | Comma separated list of packs to install. If you modify this option, be sure to also include `st2` in the list. |
106-
| `st2_ansible_extra_vars_file` | string | | Relative path from project root to Ansible vars file. If you'd like to adjust more advanced configuration; st2 version, st2.conf, RBAC, chatops, auth, etc. See https://github.com/stackStorm/ansible-st2#variables for the full list of settings. The Ansible vars will take higher precedence over the GHA inputs. |
107-
| `st2_version_tag` | | Stackstorm Ansible release tag to use. See https://github.com/StackStorm/ansible-st2/releases |
108-
| **Stack Management** |
109-
| `tf_stack_destroy` | bool | `false` | Set to `true` to Destroy the created AWS infrastructure for this instance |
110-
| `tf_state_file_name` | string | `tf-state-aws` | Change this to be anything you want to. Carefull to be consistent here. A missing file could trigger recreation, or stepping over destruction of non-defined objects. |
111-
| `tf_state_file_name_append` | string | | Appends a string to the tf-state-file name. Setting this to `unique` will generate `tf-state-aws-unique`. (Can co-exist with `tf_state_file_name`) |
112-
| `tf_state_bucket` | string | `${aws_resource_identifier}-tf-state` | AWS S3 bucket to use for Terraform state. By default, a new deployment will be created for each unique branch. Hardcode if you want to keep a shared resource state between the several branches. |
113-
| `tf_state_bucket_destroy` | bool | `false` | Force purge and deletion of `tf_state_bucket` defined. Any file contained there will be destroyed. `tf_stack_destroy` must also be `true` |
114-
| **Domain and certificates configuration** |
115-
| `aws_domain_name` | string | | Define the root domain name for the application. e.g. bitovi.com'. If empty, ELB URL will be provided. |
116-
| `aws_sub_domain` | string | `${org}-${repo}-${branch}` | Define the sub-domain part of the URL. |
117-
| `aws_root_domain` | bool | `false` | Deploy application to root domain. Will create root and www DNS records. Domain must exist in Route53. |
118-
| `aws_cert_arn` | string | | Existing certificate ARN to be used in the ELB. Use if you manage a certificate outside of this action. See [this](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-list.html) for how to find the certificate ARN. **See note**. |
119-
| `aws_create_root_cert` | bool | `false`| Generates and manage the root certificate for the application to be used in the ELB. **See note**.|
120-
| `aws_create_sub_cert` | bool | `false` | Generates and manage the sub-domain certificate for the application to be used in the ELB. **See note**.|
121-
| `aws_no_cert` | bool | `false` | Set this to true if you want not to use a certificate in the ELB. **See note**. |
122-
| **VPC configuration** |
123-
| `aws_vpc_create` | bool | | Define if a VPC should be created |
124-
| `aws_vpc_name` | string | | Define a name for the VPC. If none defined, will use `VPC for ${aws_resource_identifier}`. |
125-
| `aws_vpc_cidr_block` | string | `10.0.0.0/16` | Define Base CIDR block which is divided into subnet CIDR blocks. |
126-
| `aws_vpc_public_subnets` | string | `10.10.110.0/24` | Comma separated list of public subnets. |
127-
| `aws_vpc_private_subnets` | string | | Comma separated list of private subnets. If no input, no private subnet will be created. |
128-
| `aws_vpc_availability_zones` | string | `aws_default_region+<random>` | Comma separated list of availability zones. If a list is defined, the first zone will be the one used for the EC2 instance. |
129-
| `aws_vpc_id` | string | | AWS VPC ID to use with existing VPCs. Accepts `vpc-###` values. |
130-
| `aws_vpc_subnet_id` | string | | AWS VPC Subnet ID. If none provided, will pick one. (Ideal when there's only one) |
131-
| `aws_vpc_additional_tags` | string | | Add additional tags to the VPC resources. |
202+
#### **Action Outputs**
203+
| Name | Description |
204+
|------------------|------------------------------------|
205+
| `aws_vpc_id` | The selected VPC ID used. |
206+
| `vm_url` | The URL of the generated app. |
207+
| `instance_endpoint` | The URL of the generated ec2 instance. |
208+
| `ec2_sg_id` | SG ID for the EC2 instance. |
132209

133210
### Note about AWS resource identifiers
134211
Most resources will contain the tag `GITHUB_ORG-GITHUB_REPO-GITHUB_BRANCH` to make them unique. Because some AWS resources have a length limit, we shorten identifiers to a `60` characters max string.
@@ -190,7 +267,7 @@ jobs:
190267
steps:
191268
- id: deploy-st2-advanced
192269
name: Deploy StackStorm with extra Ansible vars
193-
uses: bitovi/[email protected].1
270+
uses: bitovi/[email protected].2
194271
with:
195272
aws_default_region: us-east-1
196273
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID}}
@@ -210,7 +287,7 @@ We encourage to keep your infrastructure codified!
210287
You can pass additional `BITOPS_` ENV variables to adjust the deployment behavior.
211288
```yaml
212289
- name: Deploy StackStorm to AWS (dry-run)
213-
uses: bitovi/[email protected].1
290+
uses: bitovi/[email protected].2
214291
env:
215292
# Extra BitOps configuration:
216293
BITOPS_LOGGING_LEVEL: INFO

0 commit comments

Comments
 (0)