Skip to content

Commit 4da4a99

Browse files
more tf to hcl
1 parent 7961250 commit 4da4a99

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tutorials/large-messages/index.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ meta:
44
description: Learn how to build a serverless architecture for handling large messages with Scaleway's NATS, Serverless Functions, and Object Storage. Follow our step-by-step Terraform-based tutorial for asynchronous file conversion using messaging, functions, and triggers.
55
content:
66
h1: Create a serverless architecture for handling large messages using Scaleway's NATS, Serverless Functions, and Object Storage.
7-
paragraph: Learn how to build a serverless architecture for handling large messages with Scaleway's NATS, Serverless Functions, and Object Storage. Follow our step-by-step Terraform-based tutorial for asynchronous file conversion using messaging, functions, and triggers.
7+
paragraph: Learn how to build a serverless architecture for handling large messages with Scaleway's NATS, Serverless Functions, and Object Storage. Follow our step-by-step Terraform-based tutorial for asynchronous file conversion using messaging, functions, and triggers.
88
categories:
99
- messaging
1010
- functions
@@ -52,7 +52,7 @@ Three essential services are required to ensure everything is working together:
5252
<Message type="tip">
5353
Remember that you can refer to the [code repository](https://github.com/rouche-q/serverless-examples/tree/main/projects/large-messages/README.md) to check all code files.
5454
</Message>
55-
```terraform
55+
```hcl
5656
terraform {
5757
required_providers {
5858
scaleway = {
@@ -74,7 +74,7 @@ Three essential services are required to ensure everything is working together:
7474
The Scaleway provider is needed, but also three providers from HashiCorp that we will use later in the tutorial.
7575

7676
2. Include two variables to enable the secure passage of your Scaleway credentials. Then initialize the Scaleway provider in the `fr-par-1` region.
77-
```terraform
77+
```hcl
7878
variable "scw_access_key_id" {
7979
type = string
8080
sensitive = true
@@ -97,7 +97,7 @@ Three essential services are required to ensure everything is working together:
9797
```
9898

9999
4. Continuing in the `main.tf` file, add the following Terraform code to create an Object Storage bucket that will be used for storing your images.
100-
```terraform
100+
```hcl
101101
resource "random_id" "bucket" {
102102
byte_length = 8
103103
}
@@ -119,7 +119,7 @@ Three essential services are required to ensure everything is working together:
119119
In this code, the resource `random_id.bucket` generates a random ID, which is then passed to the object bucket to ensure its uniqueness. Additionally, a `scaleway_object_bucket_acl` ACL is applied to the bucket, setting it to private and outputting the bucket name for use in your producer.
120120

121121
5. Add these resources to create a NATS account and your NATS credentials file:
122-
```terraform
122+
```hcl
123123
resource "scaleway_mnq_nats_account" "large_messages" {
124124
name = "nats-acc-large-messages"
125125
}
@@ -162,7 +162,7 @@ As mentioned earlier, the producer will be implemented as a straightforward shel
162162
Our script takes the file path that we want to upload as the first parameter.
163163
164164
To upload the file, we will use the AWS CLI configured with the Scaleway endpoint and credentials because Scaleway Object storage is fully compliant with S3.
165-
165+
166166
3. Pass the path to the AWS CLI command as follows:
167167
```bash
168168
aws s3 cp $1 s3://$SCW_BUCKET
@@ -211,7 +211,7 @@ We continue using the Scaleway ecosystem and deploy the consumer using a Serverl
211211
```
212212
213213
5. Before proceeding with the function's logic, improve the Terraform code by adding the following code to your `main.tf` file:
214-
```terraform
214+
```hcl
215215
resource "null_resource" "install_dependencies" {
216216
provisioner "local-exec" {
217217
command = <<-EOT
@@ -240,15 +240,15 @@ We continue using the Scaleway ecosystem and deploy the consumer using a Serverl
240240
The `null_resource` is used to download and package the correct versions of the libraries that we use with the function. Learn more about this in the [Scaleway documentation.](/serverless/functions/how-to/package-function-dependencies-in-zip/#specific-libraries-(with-needs-for-specific-c-compiled-code))
241241
242242
6. Create the function namespace.
243-
```terraform
243+
```hcl
244244
resource "scaleway_function_namespace" "large_messages" {
245245
name = "large-messages-function"
246246
description = "Large messages namespace"
247247
}
248248
```
249249
250250
7. Add the resource to set up the function.
251-
```terraform
251+
```hcl
252252
resource "scaleway_function" "large_messages" {
253253
namespace_id = scaleway_function_namespace.large_messages.id
254254
runtime = "python311"
@@ -275,15 +275,15 @@ We continue using the Scaleway ecosystem and deploy the consumer using a Serverl
275275
Essential environment variables and secrets to use in our function logic are also added.
276276
277277
8. Create the function trigger to "wake up" the function when a NATS message comes in.
278-
```terraform
278+
```hcl
279279
resource "scaleway_function_trigger" "large_messages" {
280280
function_id = scaleway_function.large_messages.id
281281
name = "large-messages-trigger"
282282
nats {
283283
account_id = scaleway_mnq_nats_account.large_messages.id
284284
subject = "large-messages"
285-
}
286-
}
285+
}
286+
}
287287
```
288288
It defines which account ID and subject to observe for getting messages.
289289
@@ -364,6 +364,6 @@ terraform apply
364364
## Conclusion, going further
365365
366366
In this introductory tutorial, we have demonstrated the usage of the NATS server for Messaging and Queuing, along with other services from the Scaleway ecosystem, to facilitate the transfer of large messages surpassing the typical size constraints. There are possibilities to expand upon this tutorial for various use cases, such as:
367-
367+
368368
- Extending the conversion capabilities to handle different document types like `docx`.
369369
- Sending URLs directly to NATS and converting HTML content to PDF.

0 commit comments

Comments
 (0)