ReferenceFlightcontrol APIEnvironmentsCreate Environment

Create Environment API

Use this API to create a new environment in your project.

API Description

MethodPath
POST/v1/projects/{projectId}/environments
Headers
AuthorizationBearer: [API key]

Full Endpoint URL https://api.flightcontrol.dev/v1/projects/{projectId}/environments

Body
ParameterTypeDescription
namestringThe environment name displayed in Flightcontrol dashboard.
regionstringThe region used to deploy the application in AWS.
sourceobject: check below for detailThe source used to build your environment.
servicesarray: check below for detailAn array of services configuration.
vpcobject: check below for detailThe networking configuration for your environment.
envVariablesobject: check below for detailThe environment variables and secrets used for your build and runtime.

The source object

ParameterTypeDescription
branchstringThe Git branch in github used to provision and build the environment’s services.
trigger”push” or “manual”Whether the environment is deployed automatically with every Git push (Git push to deploy) or deployed manually through the dashboard or deploy hooks

The services array

This is an array of service object, a service object requires at least id, name and type. For the complete list of the available properties, please refer to the relevant section of each service-type in the Configuring with code section

The vpc object

This is an optional configuration, required for advanced networking configuration, which gives you more control over the deployed infrastructure

ParameterTypeDescription
idstringOptional This is the VPC is in AWS, it needs to be an existing VPC in the same region
cidrstringOptional The exact CIDR that Flightcontrol will use to provision the new subnet for your application, make sure it does not overlap with existing CIDR in your VPC
privatebooleanOptional Whether this VPC will hold any private resources, like private RDS

The envVariables object

This is an object of key-value pairs, where the key is the envrionment variable name, for example DATABASE_URL, and the value is the plain text value of the secret that will be stored in the regional Parameter Store, for example postgres://root:password@host:port/dbName. All secrets are stored in your account, Flightcontrol never stores your secrets.

Response Example

[
  {
    "id": "project-id",
    "name": "My Project",
    "repoUrl": "https://github.com/team/project"
  }
]

Response Conditions

Success

Errors