Terraform Provider for Structurizr On-Premises
and Cloud Service.
Example:
terraform {
required_providers {
structurizr = {
source = "fstaoe/structurizr"
version = "0.2.0" # Check the version
}
}
}
variable "structurizr_admin_api_key" {
type = string
}
variable "structurizr_passphrase" {
type = string
}
provider "structurizr" {
host = "http://localhost"
admin_api_key = var.structurizr_admin_api_key
tls_insecure = true
}
# Workspace to be created with computed information from remote server
resource "structurizr_workspace" "example" {}
# Workspace to be created from a source (e.g. DSL/JSON)
resource "structurizr_workspace" "example_with_source" {
source = abspath("workspace.dsl") # The DSL/JSON file to be pushed to the Structurizr workspace
source_checksum = md5(file("workspace.dsl")) # The checksum of the source file.
}
# Workspace to be created from a source (e.g. DSL/JSON) with client-side encryption
resource "structurizr_workspace" "example_with_source" {
source = abspath("workspace.dsl") # The DSL/JSON file to be pushed to the Structurizr workspace
source_checksum = md5(file("workspace.dsl")) # The checksum of the source file.
source_passphrase = var.structurizr_passphrase
}
Install
Download the latest release and install into your
Terraform plugin directory.
Linux or Mac OSX
Run the following to have the provider installed for you automatically:
curl -fsSL https://raw.githubusercontent.com/fstaoe/terraform-provider-structurizr/main/scripts/install.sh | bash
Windows
Download the plugin to %APPDATA%\terraform.d\plugins
.
Installation notes
The structurizr provider is published to the Terraform module registry and may be installed via the standard mechanisms.
See the documentation at https://registry.terraform.io/providers/fstaoe/structurizr/latest.
Usage
https://registry.terraform.io/providers/fstaoe/structurizr/latest
Plugin |
Type |
Platform Support |
Description |
Structurizr |
Provider |
on-premises + cloud service |
Configures a target Structurizr server (such as a on-premises) |
Workspaces |
Resource |
on-premises + cloud service |
List workspaces |
Workspace |
Resource |
on-premises + cloud service |
Create, update and delete workspaces |
See our Docs folder for all plugins and our Examples to try out.
Importing Resources
All resources support importing.
Developing
Requirements
Building
Note: This project uses Go Modules making it safe to work with it outside
your existing GOPATH. The instructions that follow assume a directory in your
home directory outside the standard GOPATH (e.g. $HOME/terraform-providers/
).
- Clone the repository
- Enter the repository directory
- Download the dependencies for the provider using Make
make deps
command.
make deps
- Build the provider using the Go
install
command.
go install
Adding Dependencies
To add a new dependency github.com/author/dependency
to this project:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.
Testing
In order to run the full suite of Acceptance tests, run make testacc
.
Note: Acceptance tests create real resources, and often cost money to run.
make testacc
Documentation
To generate or update documentation:
go generate ./...
Roadmap
Plan for the next few months:
- Create Workspaces
- Import Workspaces
- Push valid DSL/JSON files with support for encryption
- Lock/Unlock Workspaces
- Publish 1.0.0
Want to see more? See CONTRIBUTING.md for more details.