|
| 1 | +--- |
| 2 | +subcategory: "Messaging and Queuing" |
| 3 | +page_title: "Scaleway: scaleway_mnq_sns_topic_subscription" |
| 4 | +--- |
| 5 | + |
| 6 | +# scaleway_mnq_sns_topic_subscription |
| 7 | + |
| 8 | +Manage Scaleway Messaging and queuing SNS Topic Subscriptions. |
| 9 | +For further information please check |
| 10 | +our [documentation](https://www.scaleway.com/en/docs/serverless/messaging/reference-content/sns-overview/) |
| 11 | + |
| 12 | +## Examples |
| 13 | + |
| 14 | +### Basic |
| 15 | + |
| 16 | +```hcl |
| 17 | +// For default project in default region |
| 18 | +resource "scaleway_mnq_sns" "main" {} |
| 19 | +
|
| 20 | +resource scaleway_mnq_sns_credentials main { |
| 21 | + project_id = scaleway_mnq_sns.main.project_id |
| 22 | + permissions { |
| 23 | + can_manage = true |
| 24 | + can_publish = true |
| 25 | + can_receive = true |
| 26 | + } |
| 27 | +} |
| 28 | +
|
| 29 | +resource "scaleway_mnq_sns_topic" "topic" { |
| 30 | + project_id = scaleway_mnq_sns.main.project_id |
| 31 | + name = "my-topic" |
| 32 | + access_key = scaleway_mnq_sns_credentials.main.access_key |
| 33 | + secret_key = scaleway_mnq_sns_credentials.main.secret_key |
| 34 | +} |
| 35 | +
|
| 36 | +resource scaleway_mnq_sns_topic_subscription main { |
| 37 | + project_id = scaleway_mnq_sns.main.project_id |
| 38 | + access_key = scaleway_mnq_sns_credentials.main.access_key |
| 39 | + secret_key = scaleway_mnq_sns_credentials.main.secret_key |
| 40 | + topic_id = scaleway_mnq_sns_topic.topic.id |
| 41 | + protocol = "http" |
| 42 | + endpoint = "http://example.com" |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +## Arguments Reference |
| 47 | + |
| 48 | +The following arguments are supported: |
| 49 | + |
| 50 | + |
| 51 | +- `protocol` - (Required) Protocol of the SNS Topic Subscription. |
| 52 | + |
| 53 | +- `topic_id` - (Optional) The ID of the topic. Either `topic_id` or `topic_arn` is required. Conflicts with `topic_arn`. |
| 54 | + |
| 55 | +- `topic_arn` - (Optional) The ARN of the topic. Either `topic_id` or `topic_arn` is required. |
| 56 | + |
| 57 | +- `access_key` - (Optional) The access key of the SNS credentials. |
| 58 | + |
| 59 | +- `secret_key` - (Optional) The secret key of the SNS credentials. |
| 60 | + |
| 61 | +- `redrive_policy` - (Optional) Activate JSON Redrive Policy. |
| 62 | + |
| 63 | +- `sns_endpoint` - (Optional) The endpoint of the SNS service. Can contain a {region} placeholder. Defaults to `https://sns.mnq.{region}.scaleway.com`. |
| 64 | + |
| 65 | +- `region` - (Defaults to [provider](../index.md#region) `region`). The [region](../guides/regions_and_zones.md#regions) |
| 66 | + in which sns is enabled. |
| 67 | + |
| 68 | +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the sns is enabled for. |
| 69 | + |
| 70 | +## Attributes Reference |
| 71 | + |
| 72 | +In addition to all arguments above, the following attributes are exported: |
| 73 | + |
| 74 | +- `id` - The ID of the topic with format `{region}/{project-id}/{topic-name}/{subscription-id}` |
| 75 | + |
| 76 | +- `arn` - The ARN of the topic subscription |
| 77 | + |
| 78 | +## Import |
| 79 | + |
| 80 | +SNS topic subscriptions can be imported using the `{region}/{project-id}/{topic-name}/{subscription-id}`, e.g. |
| 81 | + |
| 82 | +```bash |
| 83 | +$ terraform import scaleway_mnq_sns_topic_subscription.main fr-par/11111111111111111111111111111111/my-topic/11111111111111111111111111111111 |
| 84 | +``` |
0 commit comments