Create Infrastructure with Local Starter
In this section, you will find a guide on how to create your Infrastructure with a local Starter.
To create an Infrastructure, you need to choose a Starter that contains the set of Plugins to be applied. The Infrastructure can be created inside or outside a Workspace, but the Starter and Plugins must be published and available in a Studio on the StackSpot platform.
To facilitate development and testing, you can create your Starter locally and use published Plugins to generate your Infrastructure. Before starting, consider the following observations:
-
When creating the Infrastructure, the local Starter disregards the Workspace. Therefore, Infrastructures created with a local Starter cannot be registered or deployed on StackSpot.
-
The Starter file must be inside a Stack folder.
Generate local Starter structure
First, access the Stack folder. If you don't have a Stack, check out the section to create a Stack with the STK CLI.
Step 1. Create the Starter
Inside your Stack folder, run the command below and fill in the Starter information.
stk create starter
Answer the questions on your terminal:
- Name your starter: Enter a name for your Starter.
- Type: Enter the Starter type. To create an Infrastructure, choose the
Infratype. - Do you want to start a git repository?: Enter
Yto start orNto not start a Git repository. - Add remote?: If you started the Git repository, answer
Yto add a remote repository orNto not add it. - Git URL to set as remote origin: Add the URL of the remote repository (for example, a GitHub repository).
- Starter Description: Add a description explaining the Starter's purpose.
Make sure the Starter name is added to your stack.yaml file.
Step 2. Add Plugins to Starter
Within the Stack, the starters folder is generated containing the starter.yaml file. The structure is similar to the example below:
schema-version: v1
kind: starter
metadata:
name: local-starter-infra
description: Describe your starter explaining its purpose
spec:
type: infra
docs:
en-us: docs/en_us/docs.md
pt-br: docs/pt_br/docs.md
The Starter is minimally functional. You need to add Plugins from the Studios you have access to. Use the following pattern to add the Plugins you want:
schema-version: v1
kind: starter
metadata:
name: local-starter-infra
description: Describe your starter explaining its purpose
spec:
type: infra
docs:
en-us: docs/en_us/docs.md
pt-br: docs/pt_br/docs.md
plugins:
required:
- name: studio-slug/<plugin-name>
optional:
- name: studio-slug/<plugin-name>
Check out the example in the GIF below:
With the Stack and Starter ready, move on to create the Infrastructure.
Create Infrastructure with Local Starter
Run the command to create the Infrastructure using the --starter option and add the full path of the Starter file.
The command below creates an Infrastructure named infra-with-local-starter. This is just an example; you can enter any name you want.
Note: The Starter file path in the example is illustrative. Use the full path of the Starter you created in your Stack folder.
stk create infra infra-with-local-starter --starter /User/Documents/Stacks/my-stack-test2/starters/starter.yaml
The Infrastructure is created, and the Plugins listed in the Starter are applied. If desired, see other options: