Blueprints

For the latest documentation on the resource itself, refer to the Terraform Registry.

Blueprints are templated Terraform files that streamline creating similar configurations. They use tags as placeholders, enhancing reusability and customizability across diverse setups. During resource creation, the blueprint is rendered into final Terraform configuration with tags substituted by the values provided by a developer. Resourcely will open a PR containing the ready-to-apply, customized Terraform config.

Authoring Resourcely Terraform Blueprint

For more detailed steps on authoring your own blueprints, please refer to the Resourcely documentation: Authoring Your Own Blueprints.

Step 1: create a new file named basic.tft using your preferred text editor or IDE.

---
constants:
  __name: "{{ bucket }}_{{ __guid }}"
---

resource "aws_s3_bucket" "{{ __name }}" {
  bucket = "{{ bucket }}"
}

resource "aws_s3_bucket_public_access_block" "{{ __name }}" {
    bucket = aws_s3_bucket.{{ __name }}.id

    block_public_acls       = true
    block_public_policy     = true
    ignore_public_acls      = true
    restrict_public_buckets = true
}

resource "aws_s3_bucket_ownership_controls" "{{ __name }}" {
  bucket = aws_s3_bucket.{{ __name }}.id

  rule {
    object_ownership = "BucketOwnerEnforced"
  }
}

resource "aws_s3_bucket_versioning" "{{ __name }}" {
    bucket = aws_s3_bucket.{{ __name }}.id
    versioning_configuration {
        status = "{{ versioning_configuration_status }}"
    }
}

Step 2: Define the blueprint for the AWS S3 bucket referencing the Blueprint in main.tf:

resource "resourcely_blueprint" "aws_s3_basic" {
  name           = "Basic S3 bucket"
  description    = "Basic bucket with configurable versioning"
  cloud_provider = "PROVIDER_AMAZON"
  categories     = ["BLUEPRINT_BLOB_STORAGE"]
  labels         = ["s3", "private"]

  guidance       = <<-EOT
  Use this when you want a basic private bucket.

  Options:
   - Bucket name
   - Versioning (enabled/disabled)

  Properties:
   - Public access block
   - Objects are bucket owner enforced
  EOT
 content = file("basic.tft")
}

If you don't specify excluded_context_question_series then blueprint gets all global context questions by default.

Last updated