Skip to content

Commit

Permalink
fix: Add AWS_SQS_IAM_USER_ARN to notification integration (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline committed Jul 20, 2021
1 parent ff82626 commit 82a340a
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
30 changes: 29 additions & 1 deletion docs/resources/notification_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,28 @@ description: |-



## Example Usage

```terraform
resource snowflake_notification_integration integration {
name = "notification"
comment = "A notification integration."
enabled = true
type = "QUEUE"
direction = "OUTBOUND"
# AZURE_STORAGE_QUEUE
notification_provider = "AZURE_STORAGE_QUEUE"
azure_storage_queue_primary_uri = "..."
azure_tenant_id = "..."
# AWS_SQS
notification_provider = "AWS_SQS"
aws_sqs_arn = "..."
aws_sqs_role_arn = "..."
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand All @@ -22,7 +43,6 @@ description: |-
### Optional

- **aws_sqs_arn** (String) AWS SQS queue ARN for notification integration to connect to
- **aws_sqs_external_id** (String) The external ID that Snowflake will use when assuming the AWS role
- **aws_sqs_role_arn** (String) AWS IAM role ARN for notification integration to assume
- **azure_storage_queue_primary_uri** (String) The queue ID for the Azure Queue Storage queue created for Event Grid notifications
- **azure_tenant_id** (String) The ID of the Azure Active Directory tenant used for identity management
Expand All @@ -36,6 +56,14 @@ description: |-

### Read-Only

- **aws_sqs_external_id** (String) The external ID that Snowflake will use when assuming the AWS role
- **aws_sqs_iam_user_arn** (String) The Snowflake user that will attempt to assume the AWS role.
- **created_on** (String) Date and time when the notification integration was created.

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_notification_integration.example name
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import snowflake_notification_integration.example name
18 changes: 18 additions & 0 deletions examples/resources/snowflake_notification_integration/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource snowflake_notification_integration integration {
name = "notification"
comment = "A notification integration."

enabled = true
type = "QUEUE"
direction = "OUTBOUND"

# AZURE_STORAGE_QUEUE
notification_provider = "AZURE_STORAGE_QUEUE"
azure_storage_queue_primary_uri = "..."
azure_tenant_id = "..."

# AWS_SQS
notification_provider = "AWS_SQS"
aws_sqs_arn = "..."
aws_sqs_role_arn = "..."
}
11 changes: 10 additions & 1 deletion pkg/resources/notification_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ var notificationIntegrationSchema = map[string]*schema.Schema{
},
"aws_sqs_external_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "The external ID that Snowflake will use when assuming the AWS role",
},
"aws_sqs_iam_user_arn": {
Type: schema.TypeString,
Computed: true,
Description: "The Snowflake user that will attempt to assume the AWS role.",
},
"aws_sqs_arn": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -236,6 +241,10 @@ func ReadNotificationIntegration(data *schema.ResourceData, meta interface{}) er
if err = data.Set("aws_sqs_external_id", v.(string)); err != nil {
return err
}
case "AWS_SQS_IAM_USER_ARN":
if err = data.Set("aws_sqs_iam_user_arn", v.(string)); err != nil {
return err
}
case "GCP_PUBSUB_SUBSCRIPTION_NAME":
if err = data.Set("gcp_pubsub_subscription_name", v.(string)); err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion pkg/resources/notification_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ func expectReadNotificationIntegration(mock sqlmock.Sqlmock, notificationProvide
AddRow("DIRECTION", "String", "OUTBOUND", nil).
AddRow("AWS_SQS_ARN", "String", "some-sqs-arn", nil).
AddRow("AWS_SQS_ROLE_ARN", "String", "some-iam-role-arn", nil).
AddRow("AWS_SQS_EXTERNAL_ID", "String", "AGreatExternalID", nil)
AddRow("AWS_SQS_EXTERNAL_ID", "String", "AGreatExternalID", nil).
AddRow("AWS_SQS_IAM_USER_ARN", "String", "some-iam-user-arn", nil)
case "GCP_PUBSUB":
descRows = descRows.
AddRow("NOTIFICATION_PROVIDER", "String", notificationProvider, nil).
Expand Down

0 comments on commit 82a340a

Please sign in to comment.