|
| 1 | +--- |
| 2 | +subcategory: "Transactional Email" |
| 3 | +page_title: "Scaleway: scaleway_tem_webhook" |
| 4 | +--- |
| 5 | + |
| 6 | +# Resource: scaleway_tem_webhook |
| 7 | + |
| 8 | +Creates and manages Scaleway Transactional Email Webhooks. |
| 9 | +For more information, refer to [the API documentation](https://www.scaleway.com/en/developers/api/transactional-email). |
| 10 | + |
| 11 | +## Example Usage |
| 12 | + |
| 13 | +### Basic |
| 14 | + |
| 15 | +```terraform |
| 16 | +resource "scaleway_tem_webhook" "main" { |
| 17 | + domain_id = "your-domain-id" |
| 18 | + event_types = ["email_delivered", "email_bounced"] |
| 19 | + sns_arn = "arn:scw:sns:fr-par:project-xxxx:your-sns-topic" |
| 20 | + name = "example-webhook" |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +### Complete Example with Dependencies |
| 25 | + |
| 26 | +```terraform |
| 27 | +variable "domain_name" { |
| 28 | + type = string |
| 29 | +} |
| 30 | +
|
| 31 | +
|
| 32 | +resource "scaleway_mnq_sns" "sns" { |
| 33 | +} |
| 34 | +
|
| 35 | +resource "scaleway_mnq_sns_credentials" "sns_credentials" { |
| 36 | + permissions { |
| 37 | + can_manage = true |
| 38 | + } |
| 39 | +} |
| 40 | +
|
| 41 | +resource "scaleway_mnq_sns_topic" "sns_topic" { |
| 42 | + name = "test-mnq-sns-topic-basic" |
| 43 | + access_key = scaleway_mnq_sns_credentials.sns_credentials.access_key |
| 44 | + secret_key = scaleway_mnq_sns_credentials.sns_credentials.secret_key |
| 45 | +} |
| 46 | +
|
| 47 | +resource "scaleway_tem_domain" "cr01" { |
| 48 | + name = var.domain_name |
| 49 | + accept_tos = true |
| 50 | +} |
| 51 | +
|
| 52 | +resource "scaleway_domain_record" "spf" { |
| 53 | + dns_zone = var.domain_name |
| 54 | + type = "TXT" |
| 55 | + data = "v=spf1 ${scaleway_tem_domain.cr01.spf_config} -all" |
| 56 | +} |
| 57 | +
|
| 58 | +resource "scaleway_domain_record" "dkim" { |
| 59 | + dns_zone = var.domain_name |
| 60 | + name = "${scaleway_tem_domain.cr01.project_id}._domainkey" |
| 61 | + type = "TXT" |
| 62 | + data = scaleway_tem_domain.cr01.dkim_config |
| 63 | +} |
| 64 | +
|
| 65 | +resource "scaleway_domain_record" "mx" { |
| 66 | + dns_zone = var.domain_name |
| 67 | + type = "MX" |
| 68 | + data = "." |
| 69 | +} |
| 70 | +
|
| 71 | +resource "scaleway_domain_record" "dmarc" { |
| 72 | + dns_zone = var.domain_name |
| 73 | + name = scaleway_tem_domain.cr01.dmarc_name |
| 74 | + type = "TXT" |
| 75 | + data = scaleway_tem_domain.cr01.dmarc_config |
| 76 | +} |
| 77 | +
|
| 78 | +resource "scaleway_tem_domain_validation" "valid" { |
| 79 | + domain_id = scaleway_tem_domain.cr01.id |
| 80 | + region = scaleway_tem_domain.cr01.region |
| 81 | + timeout = 3600 |
| 82 | +} |
| 83 | +
|
| 84 | +resource "scaleway_tem_webhook" "webhook" { |
| 85 | + name = "example-webhook" |
| 86 | + domain_id = scaleway_tem_domain.cr01.id |
| 87 | + event_types = ["email_delivered", "email_bounced"] |
| 88 | + sns_arn = scaleway_mnq_sns_topic.sns_topic.arn |
| 89 | + depends_on = [scaleway_tem_domain_validation.valid, scaleway_mnq_sns_topic.sns_topic] |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +## Argument Reference |
| 94 | + |
| 95 | +The following arguments are supported: |
| 96 | + |
| 97 | +- `domain_id` - (Required) The ID of the domain the webhook is associated with. |
| 98 | + |
| 99 | +- `event_types` - (Required) A list of event types that trigger the webhook. |
| 100 | +- `sns_arn` - (Required) The Amazon Resource Name (ARN) of the SNS topic. |
| 101 | +- `name` - (Optional) The name of the webhook. Defaults to an autogenerated name if not provided. |
| 102 | +- `region` - (Defaults to provider region). The region in which the webhook should be created. |
| 103 | +- `project_id` - (Defaults to provider project_id) The ID of the project the webhook is associated with. |
| 104 | + |
| 105 | + |
| 106 | +## Attributes Reference |
| 107 | + |
| 108 | +In addition to all arguments above, the following attributes are exported: |
| 109 | + |
| 110 | +- `id` - The ID of the webhook. |
| 111 | +- `organization_id` - The ID of the organization the webhook belongs to. |
| 112 | +- `created_at` - The date and time of the webhook's creation (RFC 3339 format). |
| 113 | +- `updated_at` - The date and time of the webhook's last update (RFC 3339 format). |
| 114 | + |
| 115 | +## Import |
| 116 | + |
| 117 | +Webhooks can be imported using the {region}/{id}, e.g. |
| 118 | + |
| 119 | +```bash |
| 120 | +terraform import scaleway_tem_webhook.main fr-par/11111111-1111-1111-1111-111111111111 |
| 121 | +``` |
0 commit comments