Skip to content

Commit

Permalink
⭐️ support service account authentication (#6)
Browse files Browse the repository at this point in the history
* 🧹 update workflow

* 🧹 update go dependencies

* 🐛 fix tests

* 🐛 fix context handling in resources

* 🧹 removed unused data source

* 🐛 fix acceptance tests for space resource

* 🐛 fix service account resource

* 🧹 remove oci testing for now

* ⭐️ use service account for configuration of provider

* 🧹 update description of the resources

* 🧹 update documentation

* 🧹 update github actions workflow
  • Loading branch information
chris-rock authored Nov 11, 2023
1 parent 8761286 commit 82148f9
Show file tree
Hide file tree
Showing 19 changed files with 422 additions and 433 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
uses: golangci/golangci-lint-action@v3.7.0
with:
version: latest

Expand Down Expand Up @@ -77,5 +77,6 @@ jobs:
- run: go mod download
- env:
TF_ACC: "1"
MONDOO_CONFIG_BASE64: ${{ secrets.MONDOO_CONFIG_BASE64 }}
run: go test -v -cover ./internal/provider/
timeout-minutes: 10
30 changes: 0 additions & 30 deletions docs/data-sources/example.md

This file was deleted.

16 changes: 8 additions & 8 deletions docs/resources/registration_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ output "generated_token" {

### Required

- `space_id` (String) Example configurable attribute with default value
- `space_id` (String) Mondoo Space Identifier to create the token in.

### Optional

- `description` (String) Example configurable attribute with default value
- `expires_at` (String) Example configurable attribute with default value
- `expires_in` (String) Example configurable attribute with default value
- `no_exipration` (Boolean) Example configurable attribute with default value
- `revoked` (Boolean) Example configurable attribute with default value
- `description` (String) Description of the token.
- `expires_at` (String) The date and time when the token will expire.
- `expires_in` (String) The duration after which the token will expire. Format: 1h, 1d, 1w, 1m, 1y
- `no_expiration` (Boolean) If set to true, the token will not expire.
- `revoked` (Boolean) If set to true, the token is revoked.

### Read-Only

- `mrn` (String) Example identifier
- `result` (String, Sensitive) The generated random string.
- `mrn` (String) The Mondoo Resource Name (MRN) of the created token.
- `result` (String, Sensitive) The generated token.
16 changes: 8 additions & 8 deletions docs/resources/service_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "mondoo_service_account Resource - terraform-provider-mondoo"
subcategory: ""
description: |-
Example resource
Service account resource
---

# mondoo_service_account (Resource)

Example resource
Service account resource

## Example Usage

Expand Down Expand Up @@ -50,12 +50,12 @@ resource "mondoo_service_account" "service_account" {

### Optional

- `description` (String) Example configurable attribute with default value
- `name` (String) Example configurable attribute
- `org_id` (String) Example configurable attribute with default value
- `roles` (List of String) tbd
- `space_id` (String) Example configurable attribute with default value
- `description` (String) Description of the service account.
- `name` (String) Name of the service account.
- `org_id` (String) Mondoo Organization Identifier to create the service account in.
- `roles` (List of String) Roles to assign to the service account.
- `space_id` (String) Mondoo Space Identifier to create the service account in.

### Read-Only

- `mrn` (String) Example identifier
- `mrn` (String) The Mondoo Resource Name (MRN) of the created service account.
6 changes: 3 additions & 3 deletions docs/resources/space.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ resource "mondoo_space" "my_space" {

### Required

- `org_id` (String) Organization where the space is created
- `org_id` (String) Id of the organization.

### Optional

- `name` (String) Space Name
- `name` (String) Name of the space.

### Read-Only

- `id` (String) Space identifier
- `id` (String) Id of the space. Must be globally within the organization.
21 changes: 11 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ require (
github.com/hashicorp/terraform-plugin-go v0.19.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.5.1
go.mondoo.com/mondoo-go v0.0.0-20231101113453-e876aab537f7
// switch to go.mondoo.com/mondoo-go main releases once we have a release with the service account updates
go.mondoo.com/mondoo-go v0.0.0-20231111161745-5e888bc85e15
)

require (
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
Expand Down Expand Up @@ -51,19 +52,19 @@ require (
github.com/hashicorp/go-plugin v1.5.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.5.2 // indirect
github.com/hashicorp/hc-install v0.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.17.0 // indirect
github.com/hashicorp/hcl/v2 v2.18.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.18.1 // indirect
github.com/hashicorp/terraform-exec v0.19.0 // indirect
github.com/hashicorp/terraform-json v0.17.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/henvic/httpretty v0.0.6 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jedib0t/go-pretty v4.3.0+incompatible // indirect
github.com/jedib0t/go-pretty/v6 v6.4.6 // indirect
Expand Down Expand Up @@ -100,11 +101,11 @@ require (
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.13.3 // indirect
github.com/zclconf/go-cty v1.14.0 // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.1.0 // indirect
Expand Down
Loading

0 comments on commit 82148f9

Please sign in to comment.