Skip to content

Commit

Permalink
Merge pull request #3 from ukfast/tf-registry
Browse files Browse the repository at this point in the history
add docs for tf registry
  • Loading branch information
0x4c6565 committed Jul 24, 2020
2 parents 3dafcf2 + eac78a1 commit 27c08b2
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 65 deletions.
26 changes: 16 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
62 changes: 7 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > /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:
Expand All @@ -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
Documentation is located within this repository at `/docs`, and is published in the [Terraform Registry](https://registry.terraform.io/providers/ukfast/safedns/latest/docs)
16 changes: 16 additions & 0 deletions docs/data-sources/safedns_zone.md
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions docs/resources/safedns_record.md
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions docs/resources/safedns_zone.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 27c08b2

Please sign in to comment.