Skip to content

Commit e08befe

Browse files
committed
feat(apple-silicon): doc review and updates
1 parent b844b84 commit e08befe

File tree

1 file changed

+77
-60
lines changed
  • tutorials/how-to-setup-applesilicon-server-with-terraform

1 file changed

+77
-60
lines changed

tutorials/how-to-setup-applesilicon-server-with-terraform/index.mdx

Lines changed: 77 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
meta:
3-
title: Automating Apple silicon server creation: A step-by-step guide using Terraform
3+
title: Automating Apple silicon server creation using Terraform
44
description: Explore two powerful approaches to automating Apple silicon server deployment with Terraform
55
content:
6-
h1: Automating Apple silicon server creation: A step-by-step guide using Terraform
6+
h1: Automating Apple silicon server creation using Terraform
77
description: Explore two powerful approaches to automating Apple silicon server deployment with Terraform
88
categories:
99
- apple-silicon
@@ -35,10 +35,10 @@ Both Terraform and OpenTofu offer the same core functionality for provisioning a
3535

3636
2. Create a directory for your Terraform project. Open your terminal and run the following command:
3737

38-
```shell
39-
mkdir apple_silicon_server_terraform
40-
cd apple_silicon_server_terraform
41-
```
38+
```shell
39+
mkdir apple_silicon_server_terraform
40+
cd apple_silicon_server_terraform
41+
```
4242

4343
3. Create a Terraform configuration file. Inside the directory, create a file named `resources.tf`:
4444

@@ -48,83 +48,86 @@ cd apple_silicon_server_terraform
4848

4949
4. Define the required providers. Open the `resources.tf` file and add the following configuration to define the Scaleway provider and set the required Terraform version:
5050

51-
```shell
52-
terraform {
53-
required_providers {
54-
scaleway = {
55-
source = "scaleway/scaleway"
51+
```shell
52+
terraform {
53+
required_providers {
54+
scaleway = {
55+
source = "scaleway/scaleway"
56+
}
57+
}
58+
required_version = ">=0.13"
5659
}
57-
}
58-
required_version = ">=0.13"
59-
}
6060

61-
```
61+
```
6262

6363
5. Define the Apple silicon server. Add the following code to define your Apple silicon server (M2-M type) in the same `resources.tf` file:
6464

65-
```terraform
66-
#resources.tf
67-
resource "scaleway_apple_silicon_server" "server" {
68-
name = "MyAwesomeServer"
69-
type = "M2-M"
70-
zone = "fr-par-1"
71-
}
72-
```
65+
```terraform
66+
resource "scaleway_apple_silicon_server" "server" {
67+
name = "MyAwesomeServer"
68+
type = "M2-M"
69+
zone = "fr-par-1"
70+
}
71+
```
7372

7473
6. Run the following commands in your terminal to apply the configuration:
7574

76-
```shell
77-
#Initialize Terraform
78-
terraform init
79-
#Plan the deployment
80-
terraform plan
81-
#Create the server
82-
terraform apply
83-
```
75+
```shell
76+
#Initialize Terraform
77+
terraform init
78+
#Plan the deployment
79+
terraform plan
80+
#Create the server
81+
terraform apply
82+
```
8483

8584
When prompted, type **yes** to confirm the creation of the resources.
8685

8786
7. Enable Virtual Private Cloud (VPC) and a Private Network. To enhance the network setup, you can update the configuration to enable the VPC option and attach a Private Network to your Apple silicon server. Update your `resources.tf` file with the following:
8887

89-
```terraform
90-
#resources.tf
91-
resource "scaleway_vpc" "vpc01" {
92-
name = "MyAwesomeVPC"
93-
}
88+
```terraform
89+
#resources.tf
90+
resource "scaleway_vpc" "vpc01" {
91+
name = "MyAwesomeVPC"
92+
}
9493
95-
resource "scaleway_vpc_private_network" "pn01" {
96-
name = "MyAwesomePN"
97-
vpc_id = scaleway_vpc.vpc01.id
98-
}
94+
resource "scaleway_vpc_private_network" "pn01" {
95+
name = "MyAwesomePN"
96+
vpc_id = scaleway_vpc.vpc01.id
97+
}
9998
100-
resource "scaleway_apple_silicon_server" "server" {
101-
name = "MyAwesomeServer"
102-
type = "M2-M"
103-
zone = "fr-par-1"
104-
enable_vpc = true
105-
private_network {
106-
id = scaleway_vpc_private_network.pn01.id
99+
resource "scaleway_apple_silicon_server" "server" {
100+
name = "MyAwesomeServer"
101+
type = "M2-M"
102+
zone = "fr-par-1"
103+
enable_vpc = true
104+
private_network {
105+
id = scaleway_vpc_private_network.pn01.id
106+
}
107107
}
108-
}
109-
```
108+
```
109+
110110
8. Run the following command to apply the changes and update the server configuration:
111111

112-
```shell
113-
terraform apply
114-
```
112+
```shell
113+
terraform apply
114+
```
115+
116+
This will apply the new settings, ensuring that the server is launched within the specified VPC and connected to the Private Network.
115117

116-
This will apply the new settings, ensuring that the server is launched within the specified VPC and connected to the Private Network.
118+
<Message type ="tip">
119+
You can log in to the [Scaleway console](https://console.scaleway.com/asaas/servers) to view the Apple silicon server you just created.
120+
</Message>
117121

118122
## Retrieve server information
119123

120-
You can retrieve your server information after the creation by using the terraform output command. To do so, you need to define output variables in your resources.tf. For example:
124+
You can retrieve your server information after the creation by using the terraform output command. To do so, you need to define output variables in your `resources.tf`. For example:
121125

122-
```terraform
123-
#resources.tf
124-
output "server_ip" {
125-
value = scaleway_apple_silicon_server.server.ip
126-
}
127-
```
126+
```terraform
127+
output "server_ip" {
128+
value = scaleway_apple_silicon_server.server.ip
129+
}
130+
```
128131

129132
After applying the configuration, run:
130133

@@ -158,6 +161,20 @@ resource "null_resource" "store_server_ssh_key" {
158161
}
159162
}
160163
```
164+
165+
<Message type="note">
166+
If the error message below displays, run `terraform init -upgrade` to solve the issue.
167+
```
168+
Error: Inconsistent dependency lock file
169+
170+
The following dependency selections recorded in the lock file are inconsistent with the current configuration:
171+
- provider registry.terraform.io/hashicorp/null: required by this configuration but no version is selected
172+
173+
To update the locked dependency selections to match a changed configuration, run:
174+
terraform init -upgrade
175+
```
176+
</Message>
177+
161178
### Installing Homebrew and dependencies
162179

163180
Next, we can use remote-exec to install Homebrew and other essential dependencies on the server:

0 commit comments

Comments
 (0)