Skip to content

Commit

Permalink
fix: adjust to new runrs, fix CI (#5)
Browse files Browse the repository at this point in the history
* fix: run go generate ./..

* remove: example data source and function

* remove: data source example

* fix: make ID string and impl tests

* fix: tests

* fix: the world, again

* fix: tests

* fix: CODEOWNERS

* fix: run go generate

* fix: run runrs service alongside provider

* fix: workflow format
  • Loading branch information
cdbrkfxrpt authored May 29, 2024
1 parent cb8ebbb commit 35505d7
Show file tree
Hide file tree
Showing 19 changed files with 262 additions and 434 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @hashicorp/terraform-devex
* @bmc-labs/peripheral
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ updates:
directory: "/"
schedule:
interval: "daily"
# TODO: Dependabot only updates hashicorp GHAs in the template repository, the following lines can be removed for consumers of this template
allow:
- dependency-name: "hashicorp/*"
20 changes: 19 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:

generate:
runs-on: ubuntu-latest
services:
runrs:
image: ghcr.io/bmc-labs/runrs:latest
ports:
- 3000:3000
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
Expand All @@ -48,7 +53,10 @@ jobs:
with:
terraform_version: '1.8.0-alpha20240216'
terraform_wrapper: false
- run: go generate ./...
- name: pull latest OpenAPI schema for runrs and generate code
run: |
curl -O http://0.0.0.0:3000/api-docs/runrs-api.json
go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
Expand All @@ -59,6 +67,11 @@ jobs:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
services:
runrs:
image: ghcr.io/bmc-labs/runrs:latest
ports:
- 3000:3000
timeout-minutes: 15
strategy:
fail-fast: false
Expand All @@ -70,6 +83,11 @@ jobs:
- '1.2.*'
- '1.3.*'
- '1.4.*'
- '1.5.*'
- '1.6.*'
- '1.7.*'
- '1.8.*'
- '1.*.*'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
Expand Down
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ description: |-
## Example Usage

```terraform
terraform {
required_providers {
peripheral = {
source = "peripheral-cloud/peripheral"
version = "0.1.0"
}
}
}
provider "peripheral" {
# example configuration here
}
Expand Down
29 changes: 0 additions & 29 deletions docs/resources/example.md

This file was deleted.

29 changes: 29 additions & 0 deletions docs/resources/gitlab_runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "peripheral_gitlab_runner Resource - peripheral"
subcategory: ""
description: |-
GitLabRunner resource
---

# peripheral_gitlab_runner (Resource)

GitLabRunner resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) GitLabRunner ID as provided by GitLab
- `image` (String) Docker image for GitLabRunner
- `token` (String) Token for GitLabRunner registration
- `url` (String) URL of GitLab instance for GitLabRunner

### Optional

- `description` (String) Description of GitLabRunner
- `run_untagged` (Boolean) Allow untagged jobs
- `tag_list` (String) Comma-separated list of tags for GitLabRunner
1 change: 0 additions & 1 deletion examples/data-sources/runner_example/data-source.tf

This file was deleted.

9 changes: 9 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
terraform {
required_providers {
peripheral = {
source = "peripheral-cloud/peripheral"
version = "0.1.0"
}
}
}

provider "peripheral" {
# example configuration here
}
10 changes: 5 additions & 5 deletions examples/resources/runner_example/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ terraform {
}

provider "peripheral" {
endpoint = "http://127.0.0.1:3000"
endpoint = "http://0.0.0.0:3000"
}

resource "peripheral_runner" "runner" {
id = 42
resource "peripheral_gitlab_runner" "gitlab_runner" {
id = "42"
url = "https://gitlab.com"
token = "glpat-1234567890abcdef"
description = "my-runner"
Expand All @@ -21,6 +21,6 @@ resource "peripheral_runner" "runner" {
run_untagged = false
}

output "runner" {
value = peripheral_runner.runner
output "gitlab_runner" {
value = peripheral_gitlab_runner.gitlab_runner
}
Loading

0 comments on commit 35505d7

Please sign in to comment.