Skip to main content

Configure Context

In this section, you will learn how to add Stacks to Workspaces and configure contexts.


Requirements

What is Context?

To create Applications or Infrastructures within a Workspace, developers use the available Stacks. When using these Stacks, it possible configure the input values for the content within them, such as Plugins, Actions and Workflows.

This is where Context Configuration becomes crucial.

As an Account or Workspace Administrator, you can predefine the input values for content (Plugins, Actions and Workflows) in the Stacks during the configuration and definition of Context. This helps standardize the inputs and simplifies the developer's task when creating an application.

With predefined values, developers will not need to configure the inputs themselves; they will only need to accept the predefined options. This process is referred to as configuring or defining contexts.

Ways to define input values

You can set these values in three ways:

  1. As mandatory: In other words, the values will be obligatory and unchangeable;
  2. Only as suggestions: The values will already be defined for the developer, but they can edit them if they wish.
  3. By environment: You can define input values that will vary according to the environment, e.g. Dev, QA, Prod. These values can also be mandatory or just suggestions.

Context levels

Contexts can be defined at two levels on the StackSpot Platform:

  1. Account;
  2. Workspace.

This means that you can configure Contexts at Account level, so the values defined as mandatory will be used at the Workspaces level. The suggested values, on the other hand, can be changed.

When configuring Contexts at Workspace level, you must use the values defined as mandatory in the Account Context, but you can change the suggested values and define them as mandatory for creating Applications.

So, when creating an Application within this Workspace, the developer can configure only suggested values or not informed in any of the Contexts.

tip

Your Account Context may have already been configured, check the details in the account context guide.

Explaining better:

Click here to see an example of Context configuration

Scenario

In a company, the StackSpot account Admin needs to configure a Stack with an Infrastructure Plugin. It needs to be a Secret Manager on AWS to manage, retrieve, and switch database credentials, API keys, and other Secrets.

To do this, the Account/Workspace Admin needs some Secret Manager parameters to be the same to create Applications in the company.


Solution

To make sure developers use the same input parameters when creating Secret Manager Applications in the Workspace, the account needs to set up an Organization Account-level Context. Check the details:

  • Mandatory inputs: The developer cannot change.
  • Suggested Inputs: The developer can change suggested values.

For this hypothetical situation, the Admin needs to follow a few steps:

  1. Go to the Account menu;
  2. Access the Stack Secret-Manager-Demo;
  3. Access the Infrastructure Plugin Secret-Manager-Two.

To configure the Context, the account Admin needs to set the following Plugin input values:


  • Feature name: Microservice feature name;
  • Microservice name: Microservice name;
  • Owner team email
  • Tech team email: Developer email responsible for the Secret Managers;
  • KMS key Arn: ARN of the KMS key associated with the secret;
  • Environment: Environments, e.g. Dev, QA, and Prod; and
  • Region.

The values of Feature Name, Microservice name, and Owner team email can just be suggestions. But, the account/Workspaces Admin needs to set that the same engineer always be responsible for all Secret Managers, so this value must be set as Mandatory.


But the KMS key Arn, Environment, and Region values are a variable depending on the situation. They can’t be a suggestion or set as mandatory.

Result

After this configuration, when a developer accesses their Workspace to create an application using the Stack Secret Manager:

  • You need Stacks added to the Workspace;
  • Environments configured in the account;
  • Account Holder or Workspace management permissions.
warning

If you have both an Account and a Workspace context configured, and neither is set as mandatory, the Workspace context will take priority.

Once the Account context was set to mandatory in the initial configuration, it cannot be changed to Workspace. In this case, the account context always prevails and only changes if the context changes.

This scenario saves the developer's work time, because they do not need to fill out all the input fields. It also ensures the same person handles the Secret Managers.

In this section, you will learn how to configure Contexts at Workspace level.

Steps

Follow the instructions below to configure your Workspace Context:

Step 1. Log in to your account and access your Workspace;

Step 2. Click on 'Stacks';

Step 3. Select the Stack you want to configure the Inputs. If it has more than one version, select the one you need;

Step 4. Select the Stack you want to configure the Inputs for. If it has more than one version, choose the one you want to configure the Context for;

Step 5. Configure the inputs of the Stack content as Contexts. To do this, access the tab corresponding to the content you want to configure, such as 'Plugins', for example;

info

The process for configuring the inputs of Plugins, Actions and Workflows as Contexts is the same for all content types. Simply follow the instructions below, selecting the tab corresponding to the content you want to configure.

Step 6. Click on the 'Input' field. Type its value and define whether you want it to be mandatory or not:

  • Select the 'Mandatory' checkbox, to make the value mandatory and unchangeable; or
  • Leave the 'Mandatory' checkbox unmarked to leave the value as a suggestion.
warning
  • You cannot set an empty input (no value) as mandatory.
  • Remember: if any input value has been defined as mandatory in the Account Context, it cannot be changed here.

Step 7: If the Input offers the option, you can also decide to define the value per environment:

  • Enable the button 'Set value per environment' next to the input. Write down the values for each environment and define whether they are 'mandatory or not' by clicking on the checkbox.
  • Leave the button 'Set value per environment' deactivated.

Step 8. You can choose to use a Account Variable to fill in the input value. To do this, click the 'Use Variable' button next to the input and select one of the available variables that appears in the dropdown list below the input.

If the value was not configured as mandatory when the variable was created, you can change it and also set it as mandatory at the Workspace Context level.

Step 9. After you configure all the Plugin's inputs, click on the 'Save' button;

You've configured the input values of the Stack Plugins for your context;

Step 11. On the Infra Setup tab you don't need to make any settings;

You’ve successfully configured the input values of the Stack’s Content for your Context.

tip

Repeat the process with the inputs of other Content, Plugins, Workflows or Actions if you wish to configure them as Context.

Users can now create an Application or Infrastructure using the input values you defined in your Workspace Context!

Rules for filling in Context inputs

  • You cannot set an empty input (without a value) as mandatory. Remember: if any input value has been set as mandatory at the Account Context level, it cannot be changed here.

  • Input of type list: if you set this input as mandatory, all items in the list will also be mandatory. You will not be able to modify anything at levels below the Account, including values or the order of the items.

  • Input of type object: by checking the "Mandatory" checkbox, only the values of the objects you fill in will be mandatory. Fields without a value can be modified. In the Application or Infrastructure creation flow, the user must fill in the object fields that were not configured previously.

  • Input of type list containing object: if you define a list of objects as mandatory, the order of the list cannot be changed, and new items cannot be added in the Workspace. However, the fields within the objects can be modified. To make them mandatory, enter the values in each field. During the Application and Infrastructure creation process, the user will not be able to add or remove items from the main list. However, they will be able to fill in the missing fields of the internal objects that have not yet been configured.

  • Input of type required-connection: at the Account level, it is not possible to set a Context because it is not guaranteed that the Connection Interface will be visible to the entire Account. However, at the Workspace level, you can define whether the Connection Interface is mandatory or not.

Configuring Context values using Account Variables

You can choose to use an Account Variable to fill in the input value. To do this:

  1. Click the "Use variable" button next to the input field;
  2. Select one of the available Variables from the list that appears.

If the value was not set as mandatory when the Variable was created, you can change it and also set it as mandatory at the Workspace Context level.

Check the flow in the following image:

Screenshot of the StackSpot EDP Portal on the Plugin configuration screen within the flow to configure Context inside a Workspace called Zup Pay. The screen shows the Applications section selected with the Apply Plugins step and the Database backup URL input field selected with a dropdown open below showing a list of Variables.

Update Context values automatically

To configure Contexts, the input values of Plugins, Actions and Workflows are configured according to the version of the Stack. Each version can have different input values.

So, if someone publishes a new version of the Stack added to your Workspace, the context must be configured again. You can do this automatically, just by importing the values of the version of the Stack that you had previously configured.

warning

Only the name field is imported between Stack versions, as it is the only common field between versions. In other words, you need to configure the context of the new inputs such as user and port, for example.

Advantages

Updating the context values saves you from manually updating and repeating the values. This work would be extensive and repetitive if the Stack is large and has many Plugins.

For example:

  1. You have configured the context of a version 1.0.0 Stack in your Workspace.
  2. The Stack developer has created a new version, 2.0.0.
  3. You receive a notice on the dashboard that you can import the values you configured in the previous version.
  4. If you confirm, StackSpot will import the values into version 2.0.0. Plugins and Actions will automatically have the same values as in the previous version.
warning

When a Workflow is executed, the Plugin Context is not taken into account. In other words, the Context is always that of the main Workflow, since Contexts of child Workflows or other components executed within the main Workflow are ignored.

How it works

When you add a new version of Stack to your Workspace, a notification appears on the dashboard informing you that you can import the context of previous versions. To import, follow the instructions below:

Step 1: Access the Workspace and click on 'Stacks';

Step 2. In the dashboard notification or within the Stack card, click on the button 'Import input settings' ;

Portal screen on the Stacks page of a Workspace called Iti

Step 3: Select the Stacks and the respective versions you want to import the settings from. Only contexts configured at Workspace level will be imported; ;

tip

Select the recommended version.

Step 4. Click on 'Submit' button.

You've imported the Context from a previous Stack version. Now, you can configure whatever you need.

Next Step