From eac78a1a1b6690e317c376da70c2feb3e5be5678 Mon Sep 17 00:00:00 2001 From: Lee Spottiswood Date: Fri, 24 Jul 2020 09:21:35 +0100 Subject: [PATCH] add docs for tf registry --- .goreleaser.yml | 26 ++++++++----- README.md | 62 ++++--------------------------- docs/data-sources/safedns_zone.md | 16 ++++++++ docs/index.md | 20 ++++++++++ docs/resources/safedns_record.md | 22 +++++++++++ docs/resources/safedns_zone.md | 16 ++++++++ 6 files changed, 97 insertions(+), 65 deletions(-) create mode 100644 docs/data-sources/safedns_zone.md create mode 100644 docs/index.md create mode 100644 docs/resources/safedns_record.md create mode 100644 docs/resources/safedns_zone.md diff --git a/.goreleaser.yml b/.goreleaser.yml index ae44d73..9cd37ed 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,27 +1,33 @@ -project_name: terraform-provider-safedns before: hooks: - - go mod download + - go mod tidy builds: - env: - - CGO_ENABLED=0 - - GO111MODULE=on + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' goos: - windows - linux - darwin goarch: - amd64 + - '386' - arm - arm64 + ignore: + - goos: darwin + goarch: '386' + binary: '{{ .ProjectName }}_v{{ .Version }}' archives: -- format_overrides: - - goos: windows - format: zip +- format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ .Tag }}-next" + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 release: disable: true changelog: diff --git a/README.md b/README.md index e4d6f04..49f6a84 100644 --- a/README.md +++ b/README.md @@ -2,34 +2,16 @@ ## Getting Started -To get started, the `terraform-provider-safedns` binary (`.exe` extension if Windows) should be downloaded from [Releases](https://github.com/ukfast/terraform-provider-safedns/releases) and placed in a directory. For this example, -we'll place it at `/tmp/terraform-provider-safedns`. +This provider is available via the [Terraform Registry](https://registry.terraform.io/providers/ukfast/safedns/latest) with Terraform v0.13+ -Next, we'll go ahead and create a new directory to hold our `terraform` file and state: +## Getting Started (manual) -```console -mkdir /home/user/terraform -``` - -We'll then create an example terraform file `/home/user/terraform/test.tf`: - -```console -cat < /home/user/terraform/test.tf -provider "safedns" { - api_key = "abc" -} +To get started, the `terraform-provider-safedns` binary (`.exe` extension if Windows) should be downloaded from [Releases](https://github.com/ukfast/terraform-provider-safedns/releases) and placed in the plugins directory (see [here](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins) for more information). For this example, we'll place it in `~/.terraform.d/plugins/` -resource "safedns_zone" "zone-1" { - name = "example.com" - description = "example zone" -} -EOF -``` - -We'll then need to initialise terraform with our provider (specifying `plugin-dir` as the path to where the provider was downloaded to earlier): +We'll then need to initialise terraform with our provider: ```console -terraform init -get-plugins=false -plugin-dir=/tmp/terraform-provider-safedns +terraform init ``` Finally, we can invoke `terraform apply` to apply our terraform configuration: @@ -38,36 +20,6 @@ Finally, we can invoke `terraform apply` to apply our terraform configuration: terraform apply ``` -## Provider - -**Parameters** - -- `api_key`: UKFast API key - read/write permissions for `safedns` service required. If omitted, will use `UKF_API_KEY` environment variable value - -## Resources - -### safedns_zone - -**Schema** - -- `name`: (Required) Name of zone e.g. `example.com` -- `description`: Description for zone - -### safedns_record - -**Schema** - -- `name`: (Required) Name of record e.g. `something.example.com` -- `zone_name`: (Required) Name of zone for record e.g. `example.com` -- `type`: (Required) Type of record -- `content`: (Required) Content for record -- `priority`: Priority of - -## Data sources - -### safedns_zone - -**Schema** +## Documentation -- `name`: (Required) Name of zone e.g. `example.com` -- `description`: Description for zone \ No newline at end of file +Documentation is located within this repository at `/docs`, and is published in the [Terraform Registry](https://registry.terraform.io/providers/ukfast/safedns/latest/docs) diff --git a/docs/data-sources/safedns_zone.md b/docs/data-sources/safedns_zone.md new file mode 100644 index 0000000..7de02b1 --- /dev/null +++ b/docs/data-sources/safedns_zone.md @@ -0,0 +1,16 @@ +# safedns_zone Data Source + +This resource represents a SafeDNS zone + +## Example Usage + +```hcl +data "safedns_zone" "example-1" { + name = "example.com" +} +``` + +## Argument Reference + +* `name`: (Required) Name of zone e.g. `example.com` +* `description`: Description for zone \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..be1cb7b --- /dev/null +++ b/docs/index.md @@ -0,0 +1,20 @@ +# SafeDNS Provider + +Official UKFast SafeDNS Terraform provider, allowing for manipulation of SafeDNS + +## Example Usage + +```hcl +provider "safedns" { + api_key = "abc" +} + +resource "safedns_zone" "zone-1" { + name = "example.com" + description = "example zone" +} +``` + +## Argument Reference + +* `api_key`: UKFast API key - read/write permissions for `safedns` service required. If omitted, will use `UKF_API_KEY` environment variable value \ No newline at end of file diff --git a/docs/resources/safedns_record.md b/docs/resources/safedns_record.md new file mode 100644 index 0000000..a9d6052 --- /dev/null +++ b/docs/resources/safedns_record.md @@ -0,0 +1,22 @@ +# safedns_record Resource + +This resource is for managing SafeDNS records + +## Example Usage + +```hcl +resource "safedns_record" "example-record-1" { + name = "something.example.com" + zone_name = "example.com" + type = "A" + content = "10.1.2.3" +} +``` + +## Argument Reference + +* `name`: (Required) Name of record e.g. `something.example.com` +* `zone_name`: (Required) Name of zone for record e.g. `example.com` +* `type`: (Required) Type of record +* `content`: (Required) Content for record +* `priority`: Priority of record \ No newline at end of file diff --git a/docs/resources/safedns_zone.md b/docs/resources/safedns_zone.md new file mode 100644 index 0000000..6d0fa3d --- /dev/null +++ b/docs/resources/safedns_zone.md @@ -0,0 +1,16 @@ +# safedns_zone Resource + +This resource is for managing SafeDNS zones + +## Example Usage + +```hcl +resource "safedns_zone" "example-1" { + name = "example.com" +} +``` + +## Argument Reference + +* `name`: (Required) Name of zone e.g. `example.com` +* `description`: Description for zone \ No newline at end of file