Skip to content

Commit 9ba8c81

Browse files
authored
Update docs for TF modules (#368)
1 parent 0f80de5 commit 9ba8c81

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

Diff for: .idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/index.md

+50
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,53 @@ provider "civo" {
112112
<a id="credentials_file"></a>
113113
- `credentials_file` (string) specify a location for a file containing your civo credentials token
114114
- `token` (String) (**Deprecated**) for legacy reasons the user can still specify the token as an input, but in order to avoid storing that in terraform state we have deprecated this and will be remove in future versions - don't use it.
115+
116+
## Configuring Modules
117+
118+
Terraform modules allow you to group resources and reuse configurations efficiently. Below are examples of how to configure modules with the Civo provider.
119+
120+
### Example Module Usage
121+
122+
To use a module with the Civo provider, create a module directory and define your infrastructure in it.
123+
124+
**Module Definition** (`modules/civo-instance/main.tf`)
125+
126+
```
127+
variable "region" {}
128+
variable "instance_size" {}
129+
130+
provider "civo" {
131+
region = var.region
132+
}
133+
134+
resource "civo_instance" "example" {
135+
hostname = "example-instance"
136+
size = var.instance_size
137+
region = var.region
138+
}
139+
```
140+
**Root Module** (`main.tf`)
141+
```
142+
module "civo_instance" {
143+
source = "./modules/civo-instance"
144+
region = "LON1"
145+
instance_size = "g3.small"
146+
}
147+
```
148+
149+
This approach helps in managing infrastructure more efficiently by keeping configurations modular and reusable.
150+
**Please note since this is a non-hashicorp maintained provider, every module should have its own provider block.**
151+
Reference: [Terraform Modules](https://developer.hashicorp.com/terraform/language/providers/requirements)
152+
153+
## Argument Reference
154+
155+
### Optional
156+
157+
`api_endpoint` (String) The Base URL to use for CIVO API.
158+
159+
`region` (String) This sets the default region for all resources. If no default region is set, you will need to specify individually in every resource.
160+
161+
162+
`credentials_file` (string) Specify a location for a file containing your Civo credentials token.
163+
164+
`token` (String) (Deprecated) For legacy reasons, the user can still specify the token as an input, but in order to avoid storing that in Terraform state, we have deprecated this and will remove it in future versions—don't use it.

0 commit comments

Comments
 (0)