-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (43 loc) · 1.33 KB
/
create-space.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
name: create-space
on:
workflow_dispatch:
inputs:
dns_prefix:
required: true
type: string
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.4.7"
- name: Create file for space
run : |
cat > ${{ github.actor }}.software-engineer.space.tf << EOF
module "${{ inputs.dns_prefix }}" {
source = "./modules/software-engineer-space"
github_handle = "${{ github.actor }}"
domain_prefix = "${{ inputs.dns_prefix }}"
cloudflare_zone_id = cloudflare_zone.software-engineer-space.id
providers = {
cloudflare = cloudflare
github = github
}
}
EOF
- name: Commit the new file for space
run: |
git config user.name github-actions
git config user.email [email protected]
git add ${{ github.actor }}.software-engineer.space.tf
git commit -am "Add space for ${{ github.actor }} as ${{ inputs.dns_prefix }}.software-engineer.space.tf"
git push
- name: Run terraform
run: |
terraform init
terraform apply -auto-approve
terraform apply -auto-approve