Skip to content

Commit 6614b25

Browse files
authored
Merge pull request #143 from redhat-cop/patchback/backports/stable-3/de22d7f65674340e533a346c4631d8254724c9bc/pr-127
[PR #127/de22d7f6 backport][stable-3] Backstage templates
2 parents 4ddfc3c + e63d020 commit 6614b25

File tree

3 files changed

+283
-0
lines changed

3 files changed

+283
-0
lines changed

extensions/patterns/configure_ec2/template_rhdh/configure_ec2.yml

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: cloud-configure-ec2
5+
title: AWS Operations / Create EC2 Instance
6+
description: This wizard will guide you on how to create EC2 instance in the Amazon cloud
7+
namespace: default
8+
tags:
9+
- aap-operations
10+
- intermediate
11+
- cloud-aws-ops
12+
- configure-ec2-pattern
13+
- create-ec2-instance
14+
spec:
15+
type: service
16+
parameters:
17+
- title: Prompts
18+
description: Create EC2 instance in the Amazon cloud
19+
required:
20+
- token
21+
- inventory
22+
properties:
23+
token:
24+
title: Token
25+
type: string
26+
description: Oauth2 token
27+
ui:field: AAPTokenField
28+
ui:widget: password
29+
ui:backstage:
30+
review:
31+
show: false
32+
inventory:
33+
title: Inventory
34+
description: Please enter the inventory you want to use the services on
35+
resource: inventories
36+
ui:field: AAPResourcePicker
37+
credentials:
38+
title: Credentials
39+
description: Select credentials for accessing AWS.
40+
The credentials need to be of type "Amazon Web Services".
41+
type: array
42+
ui:field: AAPResourcePicker
43+
resource: credentials
44+
verbosity:
45+
title: Verbosity
46+
description: Control the level of output Ansible will produce as the playbook executes.
47+
resource: verbosity
48+
ui:field: AAPResourcePicker
49+
- title: Survey
50+
required:
51+
- aws_region
52+
- instance_name
53+
- instance_type
54+
description: Create EC2 instance in the Amazon cloud
55+
properties:
56+
aws_region:
57+
title: AWS Region
58+
description: AWS region where resources should be created
59+
type: string
60+
ui:options:
61+
rows: 5
62+
instance_name:
63+
title: Instance Name
64+
description: Name of EC2 instance to create
65+
type: string
66+
ui:options:
67+
rows: 5
68+
instance_type:
69+
title: Instance Type
70+
description: Type of EC2 instance to create (e.g., t2.micro, m5.large)
71+
type: string
72+
ui:options:
73+
rows: 5
74+
ami_id:
75+
title: AMI ID
76+
description: Amazon Machine Image (AMI) ID to use for the instance, if not provided will default to the RHEL 9 AMI for the provided region and instance type
77+
type: string
78+
ui:options:
79+
rows: 5
80+
key_name:
81+
title: Key Pair Name
82+
description: Name of key pair to use for SSH access to the EC2 instance. If the key does not exist or is not provided, the instance will not be accessible via SSH.
83+
type: string
84+
ui:options:
85+
rows: 5
86+
wait_for_state:
87+
title: Wait for State
88+
description: Whether to wait for the EC2 instance to be in the running state before continuing. Defaults to true
89+
type: string
90+
enum:
91+
- ""
92+
- 'true'
93+
- 'false'
94+
instance_tags:
95+
title: Instance Tags
96+
description: 'A dict of tags for the instance, e.g. {"environment: test", "owner": "team foobar"}'
97+
type: string
98+
ui:options:
99+
rows: 5
100+
vpc_name:
101+
title: VPC Name
102+
description: Name of the VPC to create. Defaults to '{{instance_name}}-vpc'
103+
type: string
104+
ui:options:
105+
rows: 5
106+
vpc_cidr:
107+
title: VPC CIDR Block
108+
description: CIDR block to use for the VPC being created. Defaults to 10.0.0.0/24
109+
type: string
110+
ui:options:
111+
rows: 5
112+
subnet_cidr:
113+
title: Subnet CIDR block
114+
description: CIDR block to use for the subnet being created. 10.0.0.0/25
115+
type: string
116+
ui:options:
117+
rows: 5
118+
sg_name:
119+
title: Security Group Name
120+
description: Name of the security group to create for securing traffic to the instance. Defaults to '{{ instance_name }}-sg'
121+
type: string
122+
ui:options:
123+
rows: 5
124+
sg_description:
125+
title: Security Group Description
126+
description: Description for the security group. Defaults to 'Security group for EC2 instance {{ instance_name }}'
127+
type: string
128+
ui:options:
129+
rows: 5
130+
sg_rules:
131+
title: Security Group Rules
132+
description: 'A list of security group rules in yaml format, e.g.: - proto: tcp ports: 80 cidr_ip: 0.0.0.0/0 Defaults to allowing SSH access from within the VPC'
133+
type: string
134+
ui:options:
135+
rows: 5
136+
ui:widget: textarea
137+
external_access:
138+
title: Create External Access Resources
139+
description: Whether to create resources for external access to the EC2 instance. Defaults to true. When true, adds security groups rules allowing inbound HTTP and HTTPS traffic, creates an internet gateway, creates a custom route table routing all internet traffic to the gateway, and allocates an elastic IP address for the instance.
140+
type: string
141+
enum:
142+
- ""
143+
- 'true'
144+
- 'false'
145+
146+
steps:
147+
- id: launch-job
148+
name: Launch AWS Operations / Create EC2 Instance
149+
action: rhaap:launch-job-template
150+
input:
151+
token: ${{ parameters.token }}
152+
values:
153+
inventory: ${{ parameters.inventory }}
154+
credentials: ${{ parameters.credentials }}
155+
verbosity: ${{parameters.verbosity}}
156+
extraVariables:
157+
aws_region: ${{ parameters.aws_region }}
158+
instance_name: ${{ parameters.instance_name }}
159+
instance_type: ${{ parameters.instance_type }}
160+
ami_id: ${{ parameters.ami_id }}
161+
key_name: ${{ parameters.key_name }}
162+
wait_for_state: ${{ parameters.wait_for_state }}
163+
instance_tags: ${{ parameters.instance_tags }}
164+
vpc_name: ${{ parameters.vpc_name }}
165+
vpc_cidr: ${{ parameters.vpc_cidr }}
166+
subnet_cidr: ${{ parameters.subnet_cidr }}
167+
sg_name: ${{ parameters.sg_name }}
168+
sg_description: ${{ parameters.sg_description }}
169+
sg_rules: ${{ parameters.sg_rules }}
170+
external_access: ${{ parameters.external_access }}
171+
output:
172+
text:
173+
- title: AWS Operations / Create EC2 Instance template executed
174+
successfully
175+
content: |
176+
**Job ID:** ${{ steps['launch-job'].output.data.id }}
177+
**Job STATUS:** ${{ steps['launch-job'].output.data.status }}
178+
links:
179+
- title: View in RH AAP
180+
url: ${{ steps['launch-job'].output.data.url }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
apiVersion: scaffolder.backstage.io/v1beta3
2+
kind: Template
3+
metadata:
4+
name: cloud-terminate-ec2
5+
title: AWS Operations / Terminate EC2 Instance
6+
description: This wizard will guide you on how to terminate EC2 instance in the Amazon cloud
7+
namespace: default
8+
tags:
9+
- aap-operations
10+
- intermediate
11+
- cloud-aws-ops
12+
- configure-ec2-pattern
13+
- terminate-ec2-instance
14+
spec:
15+
type: service
16+
parameters:
17+
- title: Prompts
18+
description: Terminate EC2 instance in the Amazon cloud
19+
required:
20+
- token
21+
- inventory
22+
properties:
23+
token:
24+
title: Token
25+
type: string
26+
description: Oauth2 token
27+
ui:field: AAPTokenField
28+
ui:widget: password
29+
ui:backstage:
30+
review:
31+
show: false
32+
inventory:
33+
title: Inventory
34+
description: Please enter the inventory you want to use the services on
35+
resource: inventories
36+
ui:field: AAPResourcePicker
37+
credentials:
38+
title: Credentials
39+
description: Select credentials for accessing AWS.
40+
The credentials need to be of type "Amazon Web Services".
41+
type: array
42+
ui:field: AAPResourcePicker
43+
resource: credentials
44+
verbosity:
45+
title: Verbosity
46+
description: Control the level of output Ansible will produce as the playbook executes.
47+
resource: verbosity
48+
ui:field: AAPResourcePicker
49+
- title: Survey
50+
required:
51+
- aws_region
52+
- instance_name
53+
description: Terminate EC2 instance in the Amazon cloud
54+
properties:
55+
aws_region:
56+
title: AWS Region
57+
description: AWS region where resources should be deleted
58+
type: string
59+
ui:options:
60+
rows: 5
61+
instance_name:
62+
title: Instance Name
63+
description: Name of EC2 instance to delete
64+
type: string
65+
ui:options:
66+
rows: 5
67+
key_name:
68+
title: Key Pair Name
69+
description: Name of key pair to delete for SSH access to the EC2 instance. Defaults to '{{ instance_name }}-key'
70+
type: string
71+
ui:options:
72+
rows: 5
73+
vpc_name:
74+
title: VPC Name
75+
description: Name of the VPC to delete. Defaults to '{{instance_name}}-vpc'
76+
type: string
77+
ui:options:
78+
rows: 5
79+
steps:
80+
- id: launch-job
81+
name: Launch AWS Operations / Terminate EC2 Instance
82+
action: rhaap:launch-job-template
83+
input:
84+
token: ${{ parameters.token }}
85+
values:
86+
inventory: ${{ parameters.inventory }}
87+
credentials: ${{ parameters.credentials }}
88+
verbosity: ${{parameters.verbosity}}
89+
extraVariables:
90+
aws_region: ${{ parameters.aws_region }}
91+
instance_name: ${{ parameters.instance_name }}
92+
key_name: ${{ parameters.key_name }}
93+
vpc_name: ${{ parameters.vpc_name }}
94+
output:
95+
text:
96+
- title: AWS Operations / Terminate EC2 Instance template executed
97+
successfully
98+
content: |
99+
**Job ID:** ${{ steps['launch-job'].output.data.id }}
100+
**Job STATUS:** ${{ steps['launch-job'].output.data.status }}
101+
links:
102+
- title: View in RH AAP
103+
url: ${{ steps['launch-job'].output.data.url }}

0 commit comments

Comments
 (0)