First Blueprint

Creating and publishing your first Blueprint

What are Blueprints are powerful guided experiences for configuring and deploying cloud infrastructure. They are created and managed by central teams (Platform, SRE, DevOps, Infrastructure, etc), and used by developers.

With Blueprints:

  1. Customize Blueprint code and preview the form developers will see based on the Blueprint

  2. Developers can discover Blueprints and use Blueprint forms to configure infrastructure

  3. Terraform is generated and change requests automatically created, based on Blueprint forms

Create your first Blueprint

We'll create our first Blueprint based on an AWS RDS instance example.

Note that this Blueprint is for demonstration purposes only, and you should not use this in production. Resourcely has a variety of integrated Blueprints with embedded best practices around security, access, networking, cost, and more.

Consider the following example of Terraform for an AWS RDS Instance

Terraform
/// This is one of the basic examples from the AWS Terraform provider
/// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  db_name              = "mydb"
  engine               = "mysql"
  engine_version       = "8.0"
  instance_class       = "db.t3.micro"
  username             = "foo"
  password             = "foobarbaz"
  parameter_group_name = "default.mysql8.0"
  skip_final_snapshot  = true
}

Blueprint code

We have replaced 4 parameter inputs with {{ inline-variables }}, and added a frontmatter with a __name constant.

---
constants:
  
--

resource "aws_db_instance" "{{ __name }}"  {
  allocated_storage    = {{ allocated_storage }}
  db_name              = "mydb"
 
  engine_version       = {{ engine_version }}
  instance_class       = {{ instance_class }}
  username             = "foo"
  password             = "foobarbaz"
  parameter_group_name = "default.mysql8.0"
  skip_final_snapshot  = true
}

/// This is a basic Blueprint with some variables and a best practices naming convention

In Resourcely navigate to the Foundry, copy the Blueprint code from above, and paste it into the Blueprint Content.

Check out the Developer Experience and Terraform tabs in Resourcely. Notice that the variables we inserted are represented in the form, with field options automatically populated.

Adding variables

Let's further customize our Blueprint form by changing the Blueprint code.

Adding variables

Replace the rest of the hard-coded values in your Blueprint code with {{ inline-variables}}. It should look something like this:

Blueprint code: all parameters have variables
---
constants:
  __name: "{{ db_name }}_{{ __guid }}"
---

resource "aws_db_instance" "{{__name}}" {
  allocated_storage    = {{ allocated_storage }}
  db_name              = {{ db_name }}
  engine               = {{ engine_name }}
  engine_version       = {{ engine_version }}
  instance_class       = {{ instance_class }}
  username             = {{ username }}
  password             = {{ password }}
  parameter_group_name = {{ parameter_group_name }}
  skip_final_snapshot  = {{ skip_final_snapshot }}
}

// In this Blueprint, all parameters are associated with variables

Check out the Developer Experience tab to see how adding variables has changed your form

Variables can also be defined in frontmatter - we cover this in detail in Authoring Your Own Blueprints

Customizing variables with tags

Inline variables can be customized with a variety of tags. These tags impact the form developers will use to configure resources. Check out Authoring Your Own Blueprintsfor a detailed listing of tags.

We'll start by adding a description, a default value, and setting some as required:

Blueprint code: adding variable tags
---
constants:
  __name: "{{ db_name }}_{{ __guid }}"
---

resource "aws_db_instance" "{{__name}}" {
  allocated_storage    = {{ allocated_storage | default: 50 }}
  db_name              = {{ db_name | desc: "Your database name" }}
  engine               = {{ engine_name | default: "postgres" | desc: "Database flavor to use. We recommend Postgres version 16.4" }}
  engine_version       = {{ engine_version | default: "16.4" }}
  instance_class       = {{ instance_class | desc: "Instance size, this should be Medium or smaller" }}
  username             = {{ username }}
  password             = {{ password }}
  parameter_group_name = {{ parameter_group_name | required: false }}
  skip_final_snapshot  = {{ skip_final_snapshot | required: false }}
}

// In this Blueprint, we have added several tags.

Add variable tags to your Blueprint, or copy the above code into the Foundry Blueprint content window, and observe how it changes the form in the Developer Experience tab.

Publishing

Publish your new Blueprint by adding a name, description, provider, and categories in the Define Metadata tab. Once you have done that, the Blueprint is ready for developers to interact with it.

Next steps

From here, you can create your First Guardrail or get started using your Blueprint by creating your First Resource.

Last updated