Skip to content

Commit

Permalink
fix: Add valid property AWS_SNS_TOPIC_ARN to AWS_SNS notification pro…
Browse files Browse the repository at this point in the history
…vider (#783)
  • Loading branch information
Sowmya Nanjundappa authored Dec 10, 2021
1 parent be74d18 commit 8224954
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 25 deletions.
4 changes: 2 additions & 2 deletions docs/resources/notification_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource snowflake_notification_integration integration {
# AWS_SNS
notification_provider = "AWS_SNS"
aws_sns_arn = "..."
aws_sns_topic_arn = "..."
aws_sns_role_arn = "..."
}
```
Expand All @@ -47,8 +47,8 @@ resource snowflake_notification_integration integration {

### Optional

- **aws_sns_arn** (String) AWS SNS Topic ARN for notification integration to connect to
- **aws_sns_role_arn** (String) AWS IAM role ARN for notification integration to assume
- **aws_sns_topic_arn** (String) AWS SNS Topic ARN for notification integration to connect to
- **aws_sqs_arn** (String) AWS SQS queue ARN for notification integration to connect to
- **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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ resource snowflake_notification_integration integration {

# AWS_SNS
notification_provider = "AWS_SNS"
aws_sns_arn = "..."
aws_sns_topic_arn = "..."
aws_sns_role_arn = "..."
}
11 changes: 1 addition & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zalando/go-keyring v0.1.0/go.mod h1:RaxNwUITJaHVdQ0VC7pELPZ3tOWn13nr0gZMZEhpVU0=
github.com/zalando/go-keyring v0.1.1/go.mod h1:OIC+OZ28XbmwFxU/Rp9V7eKzZjamBJwRzC8UFJH9+L8=
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
Expand Down Expand Up @@ -1169,7 +1169,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
Expand Down Expand Up @@ -1221,11 +1220,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211011170408-caeb26a5c8c0 h1:qOfNqBm5gk93LjGZo1MJaKY6Bph39zOKz1Hz2ogHj1w=
golang.org/x/net v0.0.0-20211011170408-caeb26a5c8c0/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1316,11 +1312,8 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down Expand Up @@ -1405,8 +1398,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
golang.org/x/tools v0.0.0-20201110201400-7099162a900a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
14 changes: 7 additions & 7 deletions pkg/resources/notification_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var notificationIntegrationSchema = map[string]*schema.Schema{
Computed: true,
Description: "The Snowflake user that will attempt to assume the AWS role.",
},
"aws_sns_arn": &schema.Schema{
"aws_sns_topic_arn": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "AWS SNS Topic ARN for notification integration to connect to",
Expand Down Expand Up @@ -162,8 +162,8 @@ func CreateNotificationIntegration(data *schema.ResourceData, meta interface{})
if v, ok := data.GetOk("aws_sqs_role_arn"); ok {
stmt.SetString(`AWS_SQS_ROLE_ARN`, v.(string))
}
if v, ok := data.GetOk("aws_sns_arn"); ok {
stmt.SetString(`AWS_SNS_ARN`, v.(string))
if v, ok := data.GetOk("aws_sns_topic_arn"); ok {
stmt.SetString(`AWS_SNS_TOPIC_ARN`, v.(string))
}
if v, ok := data.GetOk("aws_sns_role_arn"); ok {
stmt.SetString(`AWS_SNS_ROLE_ARN`, v.(string))
Expand Down Expand Up @@ -271,8 +271,8 @@ func ReadNotificationIntegration(data *schema.ResourceData, meta interface{}) er
if err = data.Set("aws_sqs_iam_user_arn", v.(string)); err != nil {
return err
}
case "AWS_SNS_ARN":
if err = data.Set("aws_sns_arn", v.(string)); err != nil {
case "AWS_SNS_TOPIC_ARN":
if err = data.Set("aws_sns_topic_arn", v.(string)); err != nil {
return err
}
case "AWS_SNS_ROLE_ARN":
Expand Down Expand Up @@ -355,9 +355,9 @@ func UpdateNotificationIntegration(data *schema.ResourceData, meta interface{})
stmt.SetString("AWS_SQS_ROLE_ARN", data.Get("aws_sqs_role_arn").(string))
}

if data.HasChange("aws_sns_arn") {
if data.HasChange("aws_sns_topic_arn") {
runSetStatement = true
stmt.SetString("AWS_SNS_ARN", data.Get("aws_sns_arn").(string))
stmt.SetString("AWS_SNS_TOPIC_ARN", data.Get("aws_sns_topic_arn").(string))
}

if data.HasChange("aws_sns_role_arn") {
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/notification_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ func TestNotificationIntegrationCreate(t *testing.T) {
"comment": "great comment",
"direction": "OUTBOUND",
"notification_provider": "AWS_SNS",
"aws_sns_arn": "some-sns-arn",
"aws_sns_topic_arn": "some-sns-arn",
"aws_sns_role_arn": "some-iam-role-arn",
},
expectSQL: `^CREATE NOTIFICATION INTEGRATION "test_notification_integration" AWS_SNS_ARN='some-sns-arn' AWS_SNS_ROLE_ARN='some-iam-role-arn' COMMENT='great comment' DIRECTION='OUTBOUND' NOTIFICATION_PROVIDER='AWS_SNS' TYPE='QUEUE' ENABLED=true$`,
expectSQL: `^CREATE NOTIFICATION INTEGRATION "test_notification_integration" AWS_SNS_ROLE_ARN='some-iam-role-arn' AWS_SNS_TOPIC_ARN='some-sns-arn' COMMENT='great comment' DIRECTION='OUTBOUND' NOTIFICATION_PROVIDER='AWS_SNS' TYPE='QUEUE' ENABLED=true$`,
},
{
notificationProvider: "GCP_PUBSUB",
Expand Down Expand Up @@ -156,7 +156,7 @@ func expectReadNotificationIntegration(mock sqlmock.Sqlmock, notificationProvide
descRows = descRows.
AddRow("NOTIFICATION_PROVIDER", "String", notificationProvider, nil).
AddRow("DIRECTION", "String", "OUTBOUND", nil).
AddRow("AWS_SNS_ARN", "String", "some-sns-arn", nil).
AddRow("AWS_SNS_TOPIC_ARN", "String", "some-sns-arn", nil).
AddRow("AWS_SNS_ROLE_ARN", "String", "some-iam-role-arn", nil).
AddRow("SF_AWS_EXTERNAL_ID", "String", "AGreatExternalID", nil).
AddRow("SF_AWS_IAM_USER_ARN", "String", "some-iam-user-arn", nil)
Expand Down
4 changes: 2 additions & 2 deletions pkg/snowflake/notification_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func TestNotificationIntegration_AWS_SNS(t *testing.T) {

c.SetString(`type`, `QUEUE`)
c.SetString(`direction`, `OUTBOUND`)
c.SetString(`aws_sns_arn`, `some-sns-arn`)
c.SetString(`aws_sns_topic_arn`, `some-sns-arn`)
c.SetString(`aws_sns_role_arn`, `some-iam-role-arn`)
c.SetBool(`enabled`, true)
q = c.Statement()

r.Equal(`CREATE NOTIFICATION INTEGRATION "aws_sns" AWS_SNS_ARN='some-sns-arn' AWS_SNS_ROLE_ARN='some-iam-role-arn' DIRECTION='OUTBOUND' TYPE='QUEUE' ENABLED=true`, q)
r.Equal(`CREATE NOTIFICATION INTEGRATION "aws_sns" AWS_SNS_ROLE_ARN='some-iam-role-arn' AWS_SNS_TOPIC_ARN='some-sns-arn' DIRECTION='OUTBOUND' TYPE='QUEUE' ENABLED=true`, q)
}

0 comments on commit 8224954

Please sign in to comment.