Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 04e6233

Browse files
Add redshift_datashare resource
1 parent 8eecf52 commit 04e6233

6 files changed

Lines changed: 678 additions & 0 deletions

File tree

docs/resources/datashare.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "redshift_datashare Resource - terraform-provider-redshift"
4+
subcategory: ""
5+
description: |-
6+
Defines a Redshift datashare. Datashares allows a Redshift cluster (the "consumer") to
7+
read data stored in another Redshift cluster (the "producer"). For more information, see
8+
https://docs.aws.amazon.com/redshift/latest/dg/datashare-overview.html
9+
The redshift_datashare resource should be defined on the producer cluster.
10+
Note: Data sharing is only supported on certain Redshift instance families,
11+
such as RA3.
12+
---
13+
14+
# redshift_datashare (Resource)
15+
16+
Defines a Redshift datashare. Datashares allows a Redshift cluster (the "consumer") to
17+
read data stored in another Redshift cluster (the "producer"). For more information, see
18+
https://docs.aws.amazon.com/redshift/latest/dg/datashare-overview.html
19+
20+
The redshift_datashare resource should be defined on the producer cluster.
21+
22+
Note: Data sharing is only supported on certain Redshift instance families,
23+
such as RA3.
24+
25+
## Example Usage
26+
27+
```terraform
28+
resource "redshift_datashare" "my_datashare" {
29+
name = "my_datashare" # Required
30+
owner = "my_user" # Optional.
31+
publicly_accessible = false # Optional. Default is `false`.
32+
33+
# Optional. Specifies which schemas to expose to the datashare.
34+
schemas = [
35+
"public",
36+
"other",
37+
]
38+
}
39+
```
40+
41+
<!-- schema generated by tfplugindocs -->
42+
## Schema
43+
44+
### Required
45+
46+
- **name** (String) The name of the datashare.
47+
48+
### Optional
49+
50+
- **id** (String) The ID of this resource.
51+
- **owner** (String) The user who owns the datashare.
52+
- **publicly_accessible** (Boolean) Specifies whether the datashare can be shared to clusters that are publicly accessible. Default is `false`.
53+
- **schemas** (Set of String) Defines which schemas are exposed to the data share.
54+
55+
### Read-Only
56+
57+
- **created** (String) The date when datashare was created
58+
- **producer_account** (String) The ID for the datashare producer account.
59+
- **producer_namespace** (String) The unique cluster identifier for the datashare producer cluster.
60+
61+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "redshift_datashare" "my_datashare" {
2+
name = "my_datashare" # Required
3+
owner = "my_user" # Optional.
4+
publicly_accessible = false # Optional. Default is `false`.
5+
6+
# Optional. Specifies which schemas to expose to the datashare.
7+
schemas = [
8+
"public",
9+
"other",
10+
]
11+
}

redshift/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
pqErrorCodeInvalidSchemaName = "3F000"
1818
pqErrorCodeDeadlock = "40P01"
1919
pqErrorCodeFailedTransaction = "25P02"
20+
pqErrorCodeDuplicateSchema = "42P06"
2021
)
2122

2223
// startTransaction starts a new DB transaction on the specified database.

redshift/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func Provider() *schema.Provider {
121121
"redshift_schema": redshiftSchema(),
122122
"redshift_privilege": redshiftPrivilege(),
123123
"redshift_database": redshiftDatabase(),
124+
"redshift_datashare": redshiftDatashare(),
124125
},
125126
DataSourcesMap: map[string]*schema.Resource{
126127
"redshift_user": dataSourceRedshiftUser(),

0 commit comments

Comments
 (0)