Skip to content

Commit

Permalink
fix: add basic examples to docs (#656)
Browse files Browse the repository at this point in the history
* add basic examples to docs

* add explicit location to basic examples

* update changelog
  • Loading branch information
glimberea authored Aug 26, 2024
1 parent f105b5a commit 7d2e9bf
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Only valid hcl in resource examples
- `connections` needs to be required for `ionoscloud_vpn_wireguard_gateway` resource
- Minor documentation fix for CDN resource
- Add basic examples for NFS, VPN Gateway and Kafka resources

## 6.5.0
### Features
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/dbaas_pgsql_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and link it with the previously created cluster:
resource "ionoscloud_pg_database" "example_pg_database" {
cluster_id = ionoscloud_pg_cluster.example.id
name = "exampledatabase"
owner = <user from the database>
owner = "exampleuser"
}
```

Expand All @@ -44,4 +44,4 @@ The resource can be imported using the `clusterId` and the `name`, for example:

```shell
terraform import ionoscloud_pg_database.example {clusterId}/{name}
```
```
39 changes: 34 additions & 5 deletions docs/resources/kafka_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,39 @@ Manages a **Kafka Cluster** on IonosCloud.
This resource will create an operational Kafka Cluster. After this section completes, the provisioner can be called.

```hcl
# Basic example
resource "ionoscloud_datacenter" "example" {
name = "example-kafka-datacenter"
location = "de/fra"
}
resource "ionoscloud_lan" "example" {
datacenter_id = ionoscloud_datacenter.example.id
public = false
name = "example-kafka-lan"
}
resource "ionoscloud_kafka_cluster" "example" {
name = "example-kafka-cluster"
location = "de/fra"
version = "3.7.0"
size = "S"
connections {
datacenter_id = ionoscloud_datacenter.example.id
lan_id = ionoscloud_lan.example.id
broker_addresses = [
"192.168.1.101/24",
"192.168.1.102/24",
"192.168.1.103/24"
]
}
}
```

```hcl
# Complete example
resource "ionoscloud_datacenter" "example" {
name = "example-kafka-datacenter"
location = "de/fra"
Expand Down Expand Up @@ -70,11 +103,7 @@ resource "ionoscloud_kafka_cluster" "example" {
connections {
datacenter_id = ionoscloud_datacenter.example.id
lan_id = ionoscloud_lan.example.id
broker_addresses = [
"192.168.1.101/24",
"192.168.1.102/24",
"192.168.1.103/24"
]
broker_addresses = local.kafka_cluster_broker_ips_cidr
}
}
```
Expand Down
43 changes: 43 additions & 0 deletions docs/resources/kafka_topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,49 @@ This resource will create an operational Kafka Cluster Topic. After this section
called.

```hcl
# Basic example
resource "ionoscloud_datacenter" "example" {
name = "example-kafka-datacenter"
location = "de/fra"
}
resource "ionoscloud_lan" "example" {
datacenter_id = ionoscloud_datacenter.example.id
public = false
name = "example-kafka-lan"
}
resource "ionoscloud_kafka_cluster" "example" {
name = "example-kafka-cluster"
location = ionoscloud_datacenter.example.location
version = "3.7.0"
size = "S"
connections {
datacenter_id = ionoscloud_datacenter.example.id
lan_id = ionoscloud_lan.example.id
broker_addresses = [
"192.168.1.101/24",
"192.168.1.102/24",
"192.168.1.103/24"
]
}
}
resource "ionoscloud_kafka_cluster_topic" "example" {
cluster_id = ionoscloud_kafka_cluster.example.id
name = "kafka-cluster-topic"
location = ionoscloud_kafka_cluster.example.location
replication_factor = 1
number_of_partitions = 1
retention_time = 86400000
segment_bytes = 1073741824
}
```

```hcl
# Complete example
resource "ionoscloud_datacenter" "example" {
name = "example-kafka-datacenter"
location = "de/fra"
Expand Down
37 changes: 37 additions & 0 deletions docs/resources/vpn_ipsec_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,43 @@ network resources.
## Usage example

```hcl
# Basic example
resource "ionoscloud_datacenter" "test_datacenter" {
name = "test_vpn_gateway_basic"
location = "de/fra"
}
resource "ionoscloud_lan" "test_lan" {
name = "test_lan_basic"
public = false
datacenter_id = ionoscloud_datacenter.test_datacenter.id
}
resource "ionoscloud_ipblock" "test_ipblock" {
name = "test_ipblock_basic"
location = "de/fra"
size = 1
}
resource "ionoscloud_vpn_ipsec_gateway" "example" {
name = "ipsec_gateway_basic"
location = "de/fra"
gateway_ip = ionoscloud_ipblock.test_ipblock.ips[0]
version = "IKEv2"
description = "This gateway connects site A to VDC X."
connections {
datacenter_id = ionoscloud_datacenter.test_datacenter.id
lan_id = ionoscloud_lan.test_lan.id
ipv4_cidr = "192.168.100.10/24"
}
}
```

```hcl
# Complete example
resource "ionoscloud_datacenter" "test_datacenter" {
name = "vpn_gateway_test"
location = "de/fra"
Expand Down
75 changes: 74 additions & 1 deletion docs/resources/vpn_ipsec_tunnel.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,79 @@ connections between your network resources.
## Usage example

```hcl
# Basic example
resource "ionoscloud_datacenter" "test_datacenter" {
name = "test_vpn_gateway_basic"
location = "de/fra"
}
resource "ionoscloud_lan" "test_lan" {
name = "test_lan_basic"
public = false
datacenter_id = ionoscloud_datacenter.test_datacenter.id
}
resource "ionoscloud_ipblock" "test_ipblock" {
name = "test_ipblock_basic"
location = "de/fra"
size = 1
}
resource "ionoscloud_vpn_ipsec_gateway" "example" {
name = "ipsec_gateway_basic"
location = "de/fra"
gateway_ip = ionoscloud_ipblock.test_ipblock.ips[0]
version = "IKEv2"
description = "This gateway connects site A to VDC X."
connections {
datacenter_id = ionoscloud_datacenter.test_datacenter.id
lan_id = ionoscloud_lan.test_lan.id
ipv4_cidr = "192.168.100.10/24"
}
}
resource "ionoscloud_vpn_ipsec_tunnel" "example" {
location = "de/fra"
gateway_id = ionoscloud_vpn_ipsec_gateway.example.id
name = "example-tunnel"
remote_host = "vpn.mycompany.com"
description = "Allows local subnet X to connect to virtual network Y."
auth {
method = "PSK"
psk_key = "X2wosbaw74M8hQGbK3jCCaEusR6CCFRa"
}
ike {
diffie_hellman_group = "16-MODP4096"
encryption_algorithm = "AES256"
integrity_algorithm = "SHA256"
lifetime = 86400
}
esp {
diffie_hellman_group = "16-MODP4096"
encryption_algorithm = "AES256"
integrity_algorithm = "SHA256"
lifetime = 3600
}
cloud_network_cidrs = [
"0.0.0.0/0"
]
peer_network_cidrs = [
"1.2.3.4/32"
]
}
```

```hcl
# Complete example
resource "ionoscloud_datacenter" "test_datacenter" {
name = "vpn_gateway_test"
location = "de/fra"
Expand Down Expand Up @@ -88,7 +161,7 @@ resource "ionoscloud_vpn_ipsec_gateway" "example" {
}
resource "ionoscloud_vpn_ipsec_tunnel" "example" {
location = "es/vit"
location = "de/fra"
gateway_id = ionoscloud_vpn_ipsec_gateway.example.id
name = "example-tunnel"
Expand Down

0 comments on commit 7d2e9bf

Please sign in to comment.