Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Aggregators Release (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: Ved misra <47312748+misraved@users.noreply.github.com>
  • Loading branch information
sidr0cker and misraved authored May 9, 2023
1 parent ebfa5e7 commit acd6da1
Show file tree
Hide file tree
Showing 19 changed files with 765 additions and 71 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.10.0 (May 9, 2023)

BREAKING CHANGES:

* `resources/steampipecloud_organization`: Remove `avatar_url` argument

FEATURES:

* **New Resource:** `steampipecloud_workspace_aggregator`

## 0.9.0 (February 23, 2023)

FEATURES:
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ The following arguments are supported:

- `handle` - (Required) A friendly identifier for your connection, and must be unique across your connections.
- `plugin` - (Required) The name of the plugin.
- `organization` - (Optional) An organization ID or handle to create the connection in.
- `config` - (Optional) Configuration for the connection.
- `organization` - (Optional) An organization ID or handle to create the connection in.

For each connection resource, additional arguments are supported based on the plugin it uses. For instance, if creating a connection that uses the Zendesk plugin, the [Zendesk configuration arguments](https://hub.steampipe.io/plugins/turbot/zendesk#configuration) should be used in the connection:

Expand Down
1 change: 0 additions & 1 deletion docs/resources/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ resource "steampipecloud_organization" "example" {
The following arguments are supported:

- `handle` - (Required) A friendly identifier for your workspace, and must be unique across your workspaces.
- `avatar_url` - (Optional) A publicly accessible URL for the organization's logo.
- `display_name` - (Optional) A friendly name for your organization.
- `url` - (Optional) A publicly accessible URL for the organization.

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/organization_member.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following arguments are supported:
- `organization` - (Required) The organization ID or handle to invite the user to.
- `role` - (Required) The role of the user within the organization. Must be one of `member` or `owner`.

~> **Note:** An member can be invited either using an email address or a user handle. Providing both at the same time will result in an error.
~> **Note:** A member can be invited either using an email address or a user handle. Providing both at the same time will result in an error.

- `email` - (Optional) The email address of the user to add to the organization.
- `user_handle` - (Optional) The handle of the user to add to the organization.
Expand Down
6 changes: 3 additions & 3 deletions docs/resources/organization_workspace_member.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource "steampipecloud_organization_member" "orgmember" {
role = "member"
}
resource "steampipecloud_organization_member" "example" {
resource "steampipecloud_organization_workspace_member" "example" {
organization = steampipecloud_organization.myorg.handle
workspace_handle = steampipecloud_workspace.myworkspace.handle
user_handle = steampipecloud_organization_member.orgmember.user_handle
Expand All @@ -50,9 +50,9 @@ resource "steampipecloud_organization_member" "example" {
The following arguments are supported:

- `organization` - (Required) The organization ID or handle to which the workspace belongs to.
- `workspace_handle` - (Required) The workspace handle to which the user will be invited to.
- `user_handle` - (Required) The handle of the user to add to the workspace.
- `role` - (Required) The role of the user in the workspace of the organization. Must be one of `reader`, `admin` or `owner`.
- `user_handle` - (Required) The handle of the user to add to the workspace.
- `workspace_handle` - (Required) The workspace handle to which the user will be invited to.

## Attributes Reference

Expand Down
85 changes: 85 additions & 0 deletions docs/resources/workspace_aggregator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "steampipecloud_workspace_aggregator Resource - terraform-provider-steampipecloud"
subcategory: ""
description: |-
The `Steampipe Cloud Workspace Aggregator` represents aggregators configured in a workspace.
---

# Resource: steampipecloud_workspace_aggregator

Manages a workspace aggregator.

## Example Usage

**Create a user workspace aggregator**

```hcl
resource "steampipecloud_workspace" "test_user_workspace" {
handle = "dev"
}
resource "steampipecloud_workspace_aggregator" "all_aws_aggregator" {
workspace = steampipecloud_workspace.test_workspace.handle
handle = "all_aws"
plugin = "aws"
connections = ["aws*"]
}
```

**Create an organization workspace aggregator**

```hcl
resource "steampipecloud_workspace" "test_org_workspace" {
organization = "testorg"
handle = "dev"
}
resource "steampipecloud_workspace_aggregator" "all_aws_aggregator" {
workspace = steampipecloud_workspace.test_workspace.handle
handle = "all_aws"
plugin = "aws"
connections = ["aws*"]
}
```

## Argument Reference

The following arguments are supported:

- `connections` - (Required) The list of connection names that the aggregator will merge. The wildcard `*` is supported in the connection names. e.g. `["aws1", "aws2"]`, `["aws*"]`
- `handle` - (Required) A friendly identifier for your aggregator, which must be unique across all other schemas defined in the workspace or identity.
- `plugin` - (Required) The name of the plugin.
- `workspace` - (Required) The handle of the workspace to manage the aggregator for.
- `organization` - (Optional) The optional handle of the organization to be used when the aggregator to be managed belongs to an organization.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

- `created_at` - The ISO 8601 date & time the aggregator was created at.
- `created_by` - The unique identifier of the actor that created this aggregator.
- `type` - The type of the resource.
- `updated_at` - The ISO 8601 date & time the aggregator was last updated at.
- `updated_by` - The unique identifier of the actor that last updated this aggregator.
- `version_id` - The version ID of the aggregator.
- `workspace_id` - The unique identifier of the workspace in which the aggregator exists.
- `workspace_aggregator_id` - The unique identifier of the aggregator.

## Import

### Import User Workspace Aggregator

User workspace aggregators can be imported using an ID made up of `workspace/handle`, e.g.,

```sh
terraform import steampipecloud_workspace_aggregator.example dev/all_aws
```

### Import Organization Workspace Aggregator

Organization workspace aggregators can be imported using an ID made up of `organization/workspace/handle`, e.g.,

```sh
terraform import steampipecloud_workspace_aggregator.example myorg/dev/all_aws
```
2 changes: 1 addition & 1 deletion docs/resources/workspace_connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ resource "steampipecloud_workspace_connection" "org_test" {

The following arguments are supported:

- `workspace_handle` - (Required) The handle of the workspace to add the connection to.
- `connection_handle` - (Required) The handle of the connection to add to workspace.
- `workspace_handle` - (Required) The handle of the workspace to add the connection to.
- `organization` - (Optional) The organization ID or handle to create the connection association in.

## Attributes Reference
Expand Down
4 changes: 3 additions & 1 deletion docs/resources/workspace_mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ resource "steampipecloud_workspace" "org_dev_workspace" {
}
resource "steampipecloud_workspace_mod" "aws_tags" {
organization = steampipecloud_workspace.org_dev_workspace.organization
workspace_handle = steampipecloud_workspace.org_dev_workspace.handle
path = "github.com/turbot/steampipe-mod-aws-tags"
}
Expand All @@ -43,9 +44,10 @@ resource "steampipecloud_workspace_mod" "aws_tags" {

The following arguments are supported:

- `workspace_handle` - (Required) The handle of the workspace to install the mod in.
- `path` - (Required) The path of the public git repo containing the mod.
- `workspace_handle` - (Required) The handle of the workspace to install the mod in.
- `constraint` - (Optional) The semver constraint for the mod version to install. Defaults to "*".
- `organization` - (Optional) The optional handle of the organization to be used when the mod to be installed in a workspace belonging to an organization.

## Attributes Reference

Expand Down
75 changes: 38 additions & 37 deletions docs/resources/workspace_pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ resource "steampipecloud_workspace" "test_user_workspace" {
}
resource "steampipecloud_workspace_pipeline" "daily_cis_pipeline" {
workspace_handle = steampipecloud_workspace.test_user_workspace.handle
title = "Daily CIS Job"
pipeline = "pipeline.save_snapshot"
frequency = jsonencode({
"type": "interval",
"schedule": "daily"
})
args = jsonencode({
"resource": "aws_compliance.benchmark.cis_v140",
"snapshot_tags": {
"series": "daily_cis"
},
"visibility": "workspace",
"inputs": {},
"notifications": {},
"variables": {}
})
tags = jsonencode({
workspace_handle = steampipecloud_workspace.test_user_workspace.handle
title = "Daily CIS Job"
pipeline = "pipeline.save_snapshot"
frequency = jsonencode({
"type": "interval",
"schedule": "daily"
})
args = jsonencode({
"resource": "aws_compliance.benchmark.cis_v140",
"snapshot_tags": {
"series": "daily_cis"
},
"visibility": "workspace",
"inputs": {},
"notifications": {},
"variables": {}
})
tags = jsonencode({
"name": "daily_cis_pipeline"
})
}
Expand All @@ -52,24 +52,25 @@ resource "steampipecloud_workspace" "test_org_workspace" {
}
resource "steampipecloud_workspace_pipeline" "daily_cis_pipeline" {
workspace_handle = steampipecloud_workspace.test_org_workspace.handle
title = "Daily CIS Job"
pipeline = "pipeline.save_snapshot"
frequency = jsonencode({
"type": "interval",
"schedule": "daily"
})
args = jsonencode({
"resource": "aws_compliance.benchmark.cis_v140",
"snapshot_tags": {
"series": "daily_cis"
},
"visibility": "workspace",
"inputs": {},
"notifications": {},
"variables": {}
})
tags = jsonencode({
organization = steampipecloud_workspace.test_org_workspace.organization
workspace_handle = steampipecloud_workspace.test_org_workspace.handle
title = "Daily CIS Job"
pipeline = "pipeline.save_snapshot"
frequency = jsonencode({
"type": "interval",
"schedule": "daily"
})
args = jsonencode({
"resource": "aws_compliance.benchmark.cis_v140",
"snapshot_tags": {
"series": "daily_cis"
},
"visibility": "workspace",
"inputs": {},
"notifications": {},
"variables": {}
})
tags = jsonencode({
"name": "daily_cis_pipeline"
})
}
Expand All @@ -81,7 +82,7 @@ The following arguments are supported:

- `args` - (Required) The JSON-encoded set of arguments to be used for a pipeline run. Use `jsonencode` on a terraform type to ensure correct escaping e.g. `jsonencode({"resource": "aws_compliance.benchmark.cis_v140", "inputs": {}, "snapshot_tags": {"series": "daily_cis"}})`
- `frequency` - (Required) The JSON-encoded frequency at which the pipeline will run. Use `jsonencode` on a terraform type to ensure correct escaping e.g. `jsonencode({"type": "interval", "schedule": "daily"})`
- `pipeline` - (Required) The name of the pipeline to be executed. Only supports `pipeline.save_snapshot` for now.
- `pipeline` - (Required) The name of the pipeline to be executed. Can either be `pipeline.snapshot_dashboard` or `pipeline.snapshot_query`.
- `title` - (Required) The title of the pipeline to be created.
- `workspace` - (Required) The handle of the workspace to manage the pipeline for.
- `organization` - (Optional) The optional handle of the organization to be used when the pipeline to be managed belongs to an organization.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/workspace_snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ resource "steampipecloud_workspace_snapshot" "aws_tags_limit_snapshot" {

The following arguments are supported:

- `workspace_handle` - (Required) The handle of the workspace to create the snapshot in.
- `data` - (Required) The data to be stored for the snapshot.
- `workspace_handle` - (Required) The handle of the workspace to create the snapshot in.
- `organization` - (Optional) The optional organization handle to be used when the snapshot is to be captured for a workspace that belongs to an organization.
- `tags` - (Optional) The JSON-encoded string of tags for the snapshot. Use `jsonencode` on a terraform type to ensure correct escaping e.g. `jsonencode({Foo: "Bar"})`
- `visibility` - (Optional) The scope of the snapshot. Can either be `workspace` or `anyone_with_link`.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require github.com/turbot/go-kit v0.3.0
require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
github.com/stretchr/testify v1.7.0
github.com/turbot/steampipe-cloud-sdk-go v0.5.0
github.com/turbot/steampipe-cloud-sdk-go v0.6.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/tkrajina/go-reflector v0.5.4/go.mod h1:9PyLgEOzc78ey/JmQQHbW8cQJ1oucLlNQsg8yFvkVk8=
github.com/turbot/go-kit v0.3.0 h1:o4zZIO1ovdmJ2bHWOdXnnt8jJMIDGqYSkZvBREzFeMQ=
github.com/turbot/go-kit v0.3.0/go.mod h1:SBdPRngbEfYubiR81iAVtO43oPkg1+ASr+XxvgbH7/k=
github.com/turbot/steampipe-cloud-sdk-go v0.5.0 h1:sgMpUL/gLnT5/9v6LaUDITo40npvSn+RQD5maT03wRQ=
github.com/turbot/steampipe-cloud-sdk-go v0.5.0/go.mod h1:8M2CspUHgCGqDCJV+FNn+boBPyLRHyzDinYnoZ/kZYw=
github.com/turbot/steampipe-cloud-sdk-go v0.6.0 h1:ufAxOpKS1uq7eejuE5sfEu1+d7QAd0RBjl8Bn6+mIs8=
github.com/turbot/steampipe-cloud-sdk-go v0.6.0/go.mod h1:M42TMBdMim4bV1YTMxhKyzfSGSMo4CXUkm3wt9w7t1Y=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down
1 change: 1 addition & 0 deletions steampipecloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func Provider() *schema.Provider {
"steampipecloud_organization_workspace_member": resourceOrganizationWorkspaceMember(),
"steampipecloud_user_preferences": resourceUserPreferences(),
"steampipecloud_workspace": resourceWorkspace(),
"steampipecloud_workspace_aggregator": resourceWorkspaceAggregator(),
"steampipecloud_workspace_connection": resourceWorkspaceConnection(),
"steampipecloud_workspace_mod": resourceWorkspaceMod(),
"steampipecloud_workspace_mod_variable": resourceWorkspaceModVariable(),
Expand Down
9 changes: 0 additions & 9 deletions steampipecloud/resource_steampipecloud_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func resourceOrganization() *schema.Resource {
},
"avatar_url": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"display_name": {
Expand Down Expand Up @@ -84,10 +83,6 @@ func resourceOrganizationCreate(ctx context.Context, d *schema.ResourceData, met
Handle: handle.(string),
}

if value, ok := d.GetOk("avatar_url"); ok {
req.AvatarUrl = types.String(value.(string))
}

if value, ok := d.GetOk("display_name"); ok {
req.DisplayName = types.String(value.(string))
}
Expand Down Expand Up @@ -171,10 +166,6 @@ func resourceOrganizationUpdate(ctx context.Context, d *schema.ResourceData, met
Handle: types.String(newHandle.(string)),
}

if value, ok := d.GetOk("avatar_url"); ok {
req.AvatarUrl = types.String(value.(string))
}

if value, ok := d.GetOk("display_name"); ok {
req.DisplayName = types.String(value.(string))
}
Expand Down
Loading

0 comments on commit acd6da1

Please sign in to comment.