Skip to content

Commit e1887f4

Browse files
committed
Terraform: Implement suggestions by CodeRabbit
1 parent 05b200d commit e1887f4

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

docs/integrate/terraform/tutorial.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ To make cloud setups more manageable and predictable, this guide presents
1010
another option using [Terraform], an infrastructure-as-code tool.
1111
Terraform eliminates manual console steps to create resources.
1212
Instead, Terraform uses a configuration language that describes resources
13-
based on a given parametrization.
13+
with parameters.
1414

1515
## Example
1616

@@ -26,8 +26,11 @@ Specify several variables regarding the target environment.
2626

2727

2828
```hcl
29-
module "cratedb-cluster" {
30-
source = "[email protected]:crate/cratedb-terraform.git//aws"
29+
terraform {
30+
required_version = ">= 1.5.0"
31+
}
32+
module "cratedb_cluster" {
33+
source = "https://github.com/crate/cratedb-terraform.git//aws"
3134
3235
# Global configuration items for naming/tagging resources
3336
config = {
@@ -64,15 +67,15 @@ module "cratedb-cluster" {
6467
availability_zones = ["eu-central-1b", "eu-central-1a"]
6568
6669
# SSH key pair name for EC2 instances
67-
ssh_keypair = "cratedb-cluster"
70+
ssh_keypair = "cratedb_cluster"
6871
6972
# Enable SSH access to EC2 instances
7073
ssh_access = true
7174
}
7275
7376
# Connection information for the newly created cluster
7477
output "cratedb" {
75-
value = module.cratedb-cluster
78+
value = module.cratedb_cluster
7679
sensitive = true
7780
}
7881
```
@@ -83,8 +86,8 @@ Once you adjust all variables, initialize Terraform by installing the needed plu
8386
```bash
8487
$ terraform init
8588
Initializing modules...
86-
Downloading [email protected]:crate/cratedb-terraform.git for cratedb-cluster...
87-
- cratedb-cluster in .terraform/modules/cratedb-cluster/aws
89+
Downloading [email protected]:crate/cratedb-terraform.git for cratedb_cluster...
90+
- cratedb_cluster in .terraform/modules/cratedb_cluster/aws
8891

8992
Initializing the backend...
9093

@@ -123,7 +126,7 @@ Terraform used the selected providers to generate the following execution plan.
123126

124127
Terraform will perform the following actions:
125128

126-
# module.cratedb-cluster.aws_instance.cratedb_node[0] will be created
129+
# module.cratedb_cluster.aws_instance.cratedb_node[0] will be created
127130
+ resource "aws_instance" "cratedb_node" {
128131
+ ami = "ami-0afc0414aefc9eaa7"
129132
+ arn = (known after apply)
@@ -141,7 +144,7 @@ Terraform will perform the following actions:
141144
+ instance_type = "t3.xlarge"
142145
+ ipv6_address_count = (known after apply)
143146
+ ipv6_addresses = (known after apply)
144-
+ key_name = "cratedb-cluster"
147+
+ key_name = "cratedb_cluster"
145148
+ monitoring = (known after apply)
146149
+ outpost_arn = (known after apply)
147150
+ password_data = (known after apply)
@@ -227,7 +230,7 @@ Terraform will perform the following actions:
227230
}
228231
}
229232

230-
# module.cratedb-cluster.aws_instance.cratedb_node[1] will be created
233+
# module.cratedb_cluster.aws_instance.cratedb_node[1] will be created
231234
+ resource "aws_instance" "cratedb_node" {
232235
[...]
233236
}
@@ -259,7 +262,7 @@ cratedb = <sensitive>
259262
The `cratedb` output element contains information on the newly created cluster, such as URL and credentials.
260263
Since it contains the admin password, Terraform marks the output as sensitive and does not immediately display it. Use the `terraform output` command to display it:
261264
```bash
262-
$ terraform output cratedb
265+
$ terraform output -json cratedb | jq
263266
{
264267
"cratedb_application_url" = "https://example-project-test-lb-572e07fbd6b72b88.elb.eu-central-1.amazonaws.com:4200"
265268
"cratedb_password" = "IgqVcBV28wNX8Js1"
@@ -284,7 +287,7 @@ Terraform used the selected providers to generate the following execution plan.
284287

285288
Terraform will perform the following actions:
286289

287-
# module.cratedb-cluster.aws_instance.cratedb_node[0] will be destroyed
290+
# module.cratedb_cluster.aws_instance.cratedb_node[0] will be destroyed
288291
- resource "aws_instance" "cratedb_node" {
289292
[...]
290293
} -> null

0 commit comments

Comments
 (0)