Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple redshift_datashare resource #18

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/resources/datashare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "redshift_datashare Resource - terraform-provider-redshift"
subcategory: ""
description: |-
Defines a Redshift datashare. Datashares allows a Redshift cluster (the "consumer") to
read data stored in another Redshift cluster (the "producer"). For more information, see
https://docs.aws.amazon.com/redshift/latest/dg/datashare-overview.html
The redshift_datashare resource should be defined on the producer cluster.
Note: Data sharing is only supported on certain Redshift instance families,
such as RA3.
---

# redshift_datashare (Resource)

Defines a Redshift datashare. Datashares allows a Redshift cluster (the "consumer") to
read data stored in another Redshift cluster (the "producer"). For more information, see
https://docs.aws.amazon.com/redshift/latest/dg/datashare-overview.html

The redshift_datashare resource should be defined on the producer cluster.

Note: Data sharing is only supported on certain Redshift instance families,
such as RA3.

## Example Usage

```terraform
resource "redshift_datashare" "my_datashare" {
name = "my_datashare" # Required
owner = "my_user" # Optional.
publicly_accessible = false # Optional. Default is `false`.

# Optional. Specifies which schemas to expose to the datashare.
schemas = [
"public",
"other",
]
}
```

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

### Required

- **name** (String) The name of the datashare.

### Optional

- **id** (String) The ID of this resource.
- **owner** (String) The user who owns the datashare.
- **publicly_accessible** (Boolean) Specifies whether the datashare can be shared to clusters that are publicly accessible. Default is `false`.
- **schemas** (Set of String) Defines which schemas are exposed to the data share.

### Read-Only

- **created** (String) The date when datashare was created
- **producer_account** (String) The ID for the datashare producer account.
- **producer_namespace** (String) The unique cluster identifier for the datashare producer cluster.


11 changes: 11 additions & 0 deletions examples/resources/redshift_datashare/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "redshift_datashare" "my_datashare" {
name = "my_datashare" # Required
owner = "my_user" # Optional.
publicly_accessible = false # Optional. Default is `false`.

# Optional. Specifies which schemas to expose to the datashare.
schemas = [
"public",
"other",
]
}
1 change: 1 addition & 0 deletions redshift/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
pqErrorCodeInvalidSchemaName = "3F000"
pqErrorCodeDeadlock = "40P01"
pqErrorCodeFailedTransaction = "25P02"
pqErrorCodeDuplicateSchema = "42P06"
)

// startTransaction starts a new DB transaction on the specified database.
Expand Down
1 change: 1 addition & 0 deletions redshift/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func Provider() *schema.Provider {
"redshift_schema": redshiftSchema(),
"redshift_privilege": redshiftPrivilege(),
"redshift_database": redshiftDatabase(),
"redshift_datashare": redshiftDatashare(),
},
DataSourcesMap: map[string]*schema.Resource{
"redshift_user": dataSourceRedshiftUser(),
Expand Down
Loading