Skip to content

Commit 19b9fe5

Browse files
committed
feat(vpc): add use case final doc
1 parent c0bd597 commit 19b9fe5

File tree

5 files changed

+55
-5
lines changed

5 files changed

+55
-5
lines changed

menu/navigation.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,6 +2919,10 @@
29192919
{
29202920
"label": "Getting the most from Private Networks",
29212921
"slug": "getting-most-private-networks"
2922+
},
2923+
{
2924+
"label": "VPC use case 1: basic infrastructure",
2925+
"slug": "use-case-basic"
29222926
}
29232927
],
29242928
"label": "Additional Content",

network/vpc/how-to/create-private-network.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ While DHCP is built into all new Private Networks, it may not be automatically a
4848

4949
6. Click **Create Private Network** to finish. Your Private Network is created.
5050

51+
<Message type="tip">
52+
See our [Basic VPC use case](/network/vpc/reference-content/use-case-basic/) documentation for full details of how to create a simple infrastructure that leverages the advantages of Private Networks, including accompanying Terraform templates.
53+
</Message>
54+
5155
## How to configure CIDR
5256

5357
Private Networks have built-in **D**ynamic **H**ost **C**onfiguration **P**rotocol (DHCP). DHCP manages the allocation of private IP addresses to resources attached to the network. For this purpose, a **C**lassless **I**nter-**D**omain **R**outing (CIDR) block is defined for each Private Network, from which IP addresses will be assigned. In fact, both an IPv4 and an IPv6 CIDR block are defined.

network/vpc/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ meta:
66

77
<Alert
88
sentiment="info"
9-
title="Getting the most from your Private Networks"
9+
title="VPC Basic Use Case"
1010
>
11-
Learn how to optimize your Scaleway VPCs, Private Networks and resource connectivity with [our new guide](/network/vpc/reference-content/getting-most-private-networks/) detailing tips and best practices.
11+
Read our [Basic VPC use case](/network/vpc/reference-content/use-case-basic/) documentation for full details of how to create a simple infrastructure that leverages the advantages of Private Networks, including accompanying Terraform templates.
12+
</Message>
13+
1214
</Alert>
1315

1416
<ProductHeader

network/vpc/reference-content/getting-most-private-networks.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ For example, you may use one Private Network for frontend resources and another
4949

5050
When [creating a Private Network](/network/vpc/how-to/create-private-network/), you can let Scaleway automatically generate a CIDR block for it that is guaranteed to be unique in this VPC. All resources attached to the Private Network get a private IP address from this block. However, you also have the option to define your own CIDR block for the network. Ensure you choose a prefix and network size that is appropriate for your needs, does not overlap with that of any other Private Network in the VPC, and contains enough IP addresses for all resources that will be attached to the Private Network.
5151

52+
<Message type="tip">
53+
See our [Basic VPC use case](/network/vpc/reference-content/use-case-basic/) documentation for full details of how to create a simple infrastructure that leverages the advantages of Private Networks, including accompanying Terraform templates.
54+
</Message>
55+
5256
## Attaching resources to Private Networks
5357

5458
When you attach a resource (e.g. an Instance, an Elastic Metal server) to a Private Network, you can either:

network/vpc/reference-content/use-case-basic.mdx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ This is a basic infrastructure to leverage VPC isolation:
3333
- Administrators can access the Instances via the [Public Gateway](/network/public-gateways/concepts/#public-gateway).
3434
- External services are accessed by the Instances via the Public Gateway.
3535

36+
Full [Terraform templates](#terraform) are available for this infrastructure.
37+
3638
## Detail
3739

3840
User requests go via a domain name, whose DNS record points to the public flexible IP of a Scaleway Load Balancer. This Load Balancer is attached to a **Private Network** in a **VPC**. It distributes user traffic to multiple **Instances** which are also attached to the Private Network, and do not have their own public/flexible IP addresses. These Instances are accessible only from within the VPC. The Instances can store data to and retrieve data from **Block Storage** and a **Managed Database** attached to the same Private Network and not exposed to the internet.
@@ -89,8 +91,42 @@ Follow the steps below to create this infrastructure using the [Scaleway console
8991

9092
## Terraform
9193

92-
A Terraform template for this architecture is provided in full on our [Terraform Scaleway Provider pages](TODO-LINK). Terraform allows you to create Infrastructure as Code (IaC) to build, configure and manage your infrastructure with configuration files, rather than with the Scaleway console. The following snippet shows an extract of the configuration file:
94+
Terraform templates for this architecture are provided in full on our [Scaleway Terraform Examples repo](https://github.com/scaleway/terraform-examples/tree/main/demo-vpc-app/). Terraform allows you to create Infrastructure as Code (IaC) to build, configure and manage your infrastructure with configuration files, rather than with the Scaleway console.
95+
96+
The templates include an example "Task Tracker" application to show how the infrastructure is used. The application is containerized using Docker, deployed on an Instance in the Private Network and leverages PostgreSQL for data storage. Full instructions are provided for creating the infrastructure with Terraform and deploying the test application.
97+
98+
The following snippet shows an extract of the configuration file:
9399

94100
```
95-
SNIPPET
96-
```
101+
resource "scaleway_vpc" "vpc01" {
102+
name = "vpc_${var.app_name}"
103+
}
104+
105+
resource "scaleway_vpc_private_network" "pn01" {
106+
name = "pn_${var.app_name}"
107+
vpc_id = scaleway_vpc.vpc01.id
108+
ipv4_subnet {
109+
subnet = local.subnet
110+
}
111+
}
112+
113+
resource "scaleway_vpc_public_gateway_ip" "gwip01" {
114+
}
115+
116+
resource "scaleway_vpc_public_gateway" "pgw01" {
117+
type = "VPC-GW-S"
118+
name = "pgw_${var.app_name}"
119+
ip_id = scaleway_vpc_public_gateway_ip.gwip01.id
120+
bastion_enabled = true
121+
bastion_port = 61000
122+
}
123+
124+
resource "scaleway_ipam_ip" "vpcgw_ip" {
125+
address = cidrhost(local.subnet, 2)
126+
source {
127+
private_network_id = scaleway_vpc_private_network.pn01.id
128+
}
129+
}
130+
```
131+
132+
[See the full Terraform templates](https://github.com/scaleway/terraform-examples/tree/main/demo-vpc-app/)

0 commit comments

Comments
 (0)