Use PR automations for self-service
Use a PR Automation for an example Self-Service S3 bucket creation workflow
Overview
Cloud infrastructure changes rapidly, and often the manual nature of infrastructure-as-code workflows can become a drag on velocity, causing organizations to reach to more self-service approaches. This can involve stitching together Backstage, Gitlab, ArgoCD, or any other set of tools. Plural provides a single cloud orchestrator to provide all those key functionalities in one control plane.
We'll show how this can work beyond just a K8s provisioning usecase, to provisioning an S3 bucket, a common resource also needed by Kubernetes workloads. It'll operate by:
- Creating a PR Automation (PRA) to make the provisioning of buckets repeatable
- Using that PRA to create an
InfrastructureStack
to provision the s3 bucket using a Plural terraform stack.
Warning:
This Guide will not work properly unless you've finished the tutorial Integrate with your Source Control Provider.
Define the PR Automation
This PR Automation is going to leverage resources that have already been created in the plural up
repo for you, in particular:
terraform/modules/blob/s3
- a basic s3 bucket module we've predefined that can be used for provisioning the buckettemplates/blobstore/*
- a couple of templates that will be used to setup the blobstore provisioning process via a PRA
Given those manifests, the PR Automation yaml could be something like this, which you'd place in bootstrap/pr-automation/blobstore.yaml
apiVersion: deployments.plural.sh/v1alpha1 kind: PrAutomation metadata: name: blob-creator spec: name: blob-creator documentation: | Sets up a PR to provision a blobstore with a given type (eg s3) and region creates: templates: - source: templates/blob/stack.yaml destination: "services/blobstores/{{ context.type }}/{{ context.name }}.yaml" external: false - source: templates/blob/service.yaml destination: "bootstrap/blobstores.yaml" external: false scmConnectionRef: name: github title: "Adding a {{ context.type }} bucket {{ context.name }}" message: "Setup a stack to manage the {{ context.name }} {{ context.type }} bucket" identifier: your-org/your-plural-up-repo # <---- replace with the slug for your plural up repo configuration: - name: name type: STRING documentation: the name of this blob store (if using s3, this would become an s3 bucket name) validation: regex: "[a-z][a-z-0-9]+" - name: type type: ENUM documentation: the type of blob storage to provision values: - s3 - name: region type: STRING documentation: the region your blobstore will live in