forked from Resourcely-Inc/scaffolding-github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (180 loc) · 5.84 KB
/
resourcely-cli.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Test Resourcely-CLI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
# Mock TF plan that will be fed to Resourcely-CLI
TF_PLAN: >
{
"resource_changes": [
{
"address": "aws_instance.ec2_instance",
"change": {
"actions": [
"create"
],
"after": {
"ami": "ami-051f8a213df8bc089",
"arn": "arn:aws:ec2:us-east-1:502240965697:instance/i-0189a83c43048101e",
"associate_public_ip_address": true,
"availability_zone": "us-east-1a",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 1
}
],
"cpu_threads_per_core": 1,
"credit_specification": [
{
"cpu_credits": "standard"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-0189a83c43048101e",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_protocol_ipv6": "disabled",
"http_put_response_hop_limit": 2,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-0a8f56ec84e42b4de",
"private_dns": "ip-172-31-84-78.ec2.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "ip-name"
}
],
"private_ip": "172.31.84.78",
"public_dns": "ec2-3-90-43-110.compute-1.amazonaws.com",
"public_ip": "3.90.43.110",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": false,
"iops": 3000,
"kms_key_id": "",
"tags": {},
"tags_all": {},
"throughput": 125,
"volume_id": "vol-0513133239cbffe57",
"volume_size": 8,
"volume_type": "gp3"
}
],
"secondary_private_ips": [],
"security_groups": [
"default"
],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-0b27901c38cb7b8ff",
"tags": null,
"tags_all": {},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0b861685baed33704"
]
},
"before": null
},
"mode": "managed",
"name": "ec2_instance",
"provider_name": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"type": "aws_instance"
}
],
"version": 1.2
}
jobs:
write-plan:
name: 'Write Plan File'
runs-on: ubuntu-latest
environment: production
defaults:
run:
shell: bash
steps:
- name: Save Plan JSON to a file
uses: fishcharlie/[email protected]
with:
data: ${{ env.TF_PLAN }}
output: plan.json
- name: Upload Terraform Plan Output
uses: actions/upload-artifact@v2
with:
name: plan-file
path: plan.json
resourcely-ci:
needs: write-plan
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Terraform Plan Output
uses: actions/download-artifact@v2
with:
name: plan-file
path: tf-plan-files/
- name: Resourcely CI
uses: Resourcely-Inc/resourcely-action@main
with:
resourcely_api_token: ${{ secrets.RESOURCELY_API_TOKEN }}
resourcely_api_host: "https://funny-bunny.ngrok.dev"
tf_plan_directory: "tf-plan-files"