### Plan and Apply Terraform for Local Development Source: https://github.com/contabo/terraform-provider-contabo/blob/main/README.md After setting up the local provider, navigate to the examples directory, copy the example configuration, and then plan and apply your Terraform configuration. This step is for testing local changes. ```sh terraform plan # CAUTION: with example main.tf you are about to order and pay a Cloud VPS instance terraform apply ``` -------------------------------- ### Configure Contabo Provider and Create Object Storage Bucket Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_object_storage_bucket.md This example demonstrates how to configure the Contabo provider with your API credentials and then create a new object storage bucket. Ensure your API credentials are set correctly. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Create a new object storage resource "contabo_object_storage" "example_object_storage" { region = "EU" total_purchased_space_tb = 0.500 } # create a bucket in the object_storage resource "contabo_object_storage_bucket" "example_bucket" { name = "example_bucket" object_storage_id = contabo_object_storage.example_object_storage.id } ``` -------------------------------- ### Configure Contabo Provider and Search for Instance Snapshot Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_instance_snapshot.md This example shows how to configure the Contabo provider with your API credentials and then use the `contabo_instance_snapshot` data source to find a snapshot by its ID. The output block displays the retrieved snapshot details. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } data "contabo_instance_snapshot" "test_snapshot" { id = "66abf39a-ba8b-425e-a385-8eb347ceac10" } output "my_test_snapshot" { description = "my test snapshot" value = data.contabo_instance_snapshot.test_snapshot } ``` -------------------------------- ### Configure Contabo Provider and Get Tag Assignment Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_tag_assignment.md This example shows how to configure the Contabo provider with your API credentials and then use the contabo_tag_assignment data source to retrieve a specific tag assignment by its ID. The output block displays the retrieved tag assignment details. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } data "contabo_tag_assignment" "default_tag_assignment" { id = "178478_image_35ee288f-21ea-420c-a074-ce0a968b59c0" } output "output" { description = "output" value = data.contabo_tag_assignment.default_tag_assignment } ``` -------------------------------- ### Configure Local Terraform Provider Installation Source: https://github.com/contabo/terraform-provider-contabo/blob/main/README.md Set up your local environment to use a locally built Contabo Terraform provider binary. This involves cloning the repository, building the provider, and configuring Terraform to use the local binary. ```terraform provider_installation { dev_overrides { "contabo/contabo" = "/PATH/TO/YOUR/BINARY/BUILD" } direct {} } ``` -------------------------------- ### Minimal Custom Instance Example Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/guides/custom_instance.md This Terraform configuration sets up the Contabo provider, defines a data source for a Debian 11 image, and creates a custom instance with a specified display name and image ID. It also includes an output for the created instance. ```terraform terraform { required_providers { contabo = { source = "contabo/contabo" version = ">= 0.1.42" } } } # Configure your Contabo API credentials in provider stanza provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Set a default image so we can access it by name data "contabo_image" "debian_11" { id = "66abf39a-ba8b-425e-a385-8eb347ceac10" } # or specify one with our custom image resource "contabo_instance" "custom_instance" { display_name = "Debian 11 instance" image_id = contabo_image.debian_11.id } # Output our newly created instances output "custom_instance_output" { description = "Our first custom instance" value = contabo_instance.custom_instance } ``` -------------------------------- ### Configure Contabo Provider and Search for an Image Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_image.md This example shows how to configure the Contabo provider with your API credentials and then use the `contabo_image` data source to search for a specific image by its ID. The output block displays the retrieved image information. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } data "contabo_image" "debian_11" { id = "66abf39a-ba8b-425e-a385-8eb347ceac10" } output "my_test_image" { description = "my test image" value = data.contabo_image.debian_11 } ``` -------------------------------- ### Configure Contabo Provider and Search Object Storage Bucket Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage_bucket.md This example shows how to configure the Contabo provider with API credentials and then use the `contabo_object_storage_bucket` data source to search for a specific bucket by its Object Storage ID and name. It also includes an output block to display the retrieved bucket information. ```terraform # Configure your Contabo API credentials provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Search object storage bucket by Object Storage ID and name data "contabo_object_storage_bucket" "bucket1" { object_storage_id = "3a6e5301-fc71-42ce-b60c-49841681c2da" name = "testbucket" } output "my_test_bucket" { description = "my test bucket" value = data.contabo_object_storage_bucket.bucket1 } ``` -------------------------------- ### Configure Contabo Provider and Search for a Private Network Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_private_network.md This example shows how to configure the Contabo provider with your API credentials and then use the contabo_private_network data source to search for a specific private network by its ID. The output block displays the retrieved network details. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } data "contabo_private_network" "testnetwork" { id = "1234" } output "my_test_private_network" { description = "my test private network" value = data.contabo_private_network.testnetwork } ``` -------------------------------- ### Create Object Storage in EU Region Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_object_storage.md Create a new object storage instance in the EU region with a purchased space of 2TB. This is a basic resource creation example. ```terraform resource "contabo_object_storage" "object_storage_eu" { region = "EU" total_purchased_space_tb = 2 } ``` -------------------------------- ### Configure Contabo Provider and Search for a Secret Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_secret.md This example shows how to configure the Contabo provider with your API credentials and then use the contabo_secret data source to search for a specific secret by its ID. The output block displays the retrieved secret information. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Search for a specific secret by ID data "contabo_secret" "mysecret" { id = "123" } output "my_secret_output" { description = "my secret" value = data.contabo_secret.mysecret } ``` -------------------------------- ### Create a new Contabo compute instance Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_instance.md Create a new compute instance (vps/vds) in a specified region with a particular product ID and contract period. The example shows creating an instance named 'database' in the 'EU' region with product ID 'V92' and a 3-month contract period. ```terraform resource "contabo_instance" "database_instance" { display_name = "database" product_id = "V92" region = "EU" period = 3 } ``` -------------------------------- ### Create a default firewall Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_firewall.md This example demonstrates how to create a default firewall with specific inbound rules for TCP traffic on ports 22, 80, and 443, allowing connections from specified IPv4 and IPv6 CIDR blocks. Ensure your Contabo API credentials are configured in the provider block. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } resource "contabo_firewall" "default" { name = "default" description = "default firewall" status = "active" rules { inbound { protocol = "tcp" action = "accept" status = "active" dest_ports = ["22", "80", "443"] src_cidr { ipv4 = ["194.165.134.20", "194.165.134.21"] ipv6 = ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"] } } } } ``` -------------------------------- ### contabo_firewall Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_firewall.md Use the contabo_firewall data source to get information about an existing firewall. ```APIDOC ## contabo_firewall ### Description Use the contabo_firewall data source to get information about an existing firewall. ### Schema #### Required - `name` (String) The name of the Firewall. It may contain letters, numbers, colons, dashes, and underscores. There is a limit of 255 characters per Firewall name. - `status` (String) Status of the Firewall. It can be `active`, or `inactive`. #### Optional - `created_date` (String) The creation date of the Firewall. - `description` (String) The description of the Firewall. There is a limit of 255 characters per Firewall. - `instance_ids` (Set of Number) Add the instace Ids to the firewall here. If you do not add any instance Ids an empty firewall will be created. - `instances_status` (Block List) The status of every instance in the firewall (see [below for nested schema](#nestedblock--instances_status)) - `rules` (Block List) (see [below for nested schema](#nestedblock--rules)) #### Read-Only - `id` (String) The identifier of the Firewall. Use it to manage it! ### Nested Schema for `instances_status` Optional: - `error_message` (String) Status of the instance. Read-Only: - `instance_id` (Number) The instance - `status` (String) Status of the instance. ### Nested Schema for `rules` Optional: - `inbound` (Block List) Inbound rules for this Firewall (see [below for nested schema](#nestedblock--rules--inbound)) ### Nested Schema for `rules.inbound` Optional: - `action` (String) Action of the rule, currently there is just `accept`. - `dest_ports` (Set of String) - `protocol` (String) Define the protocol for the rule. Allowed protocols are `tcp`, `udp` and `icmp`. - `src_cidr` (Block List) (see [below for nested schema](#nestedblock--rules--inbound--src_cidr)) - `status` (String) Status of the rule. It can be `active`, or `inactive`. ### Nested Schema for `rules.inbound.src_cidr` Optional: - `ipv4` (Set of String) Provide allowed IPv4 addresses as string array for this rule - `ipv6` (Set of String) Provide allowed IPv6 addresses as string array for this rule ``` -------------------------------- ### Update a firewall with additional ports and IPs Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_firewall.md This example shows how to update an existing firewall by adding a new destination port (25) and additional IPv4 source CIDR blocks. This is useful for modifying existing firewall rules to accommodate new services or IP ranges. ```terraform resource "contabo_firewall" "default" { name = "default" description = "default firewall" status = "active" rules { inbound { protocol = "tcp" action = "accept" status = "active" dest_ports = ["22", "80", "443", "25"] src_cidr { ipv4 = ["194.165.134.20", "194.165.134.21", "194.165.134.22", "194.165.134.23"] ipv6 = ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"] } } } } ``` -------------------------------- ### Configure Contabo Provider and Get a Specific Tag Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_tag.md Configure your Contabo API credentials using the provider block. Then, retrieve a specific tag by its ID using the data source. ```terraform # Configure your Contabo API credentials provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Get a specific tag by ID data "contabo_tag" "default_tag" { id="26878" } output "output" { description = "output" value = data.contabo_tag.default_tag } ``` -------------------------------- ### Initialize and Apply Terraform Configuration Source: https://github.com/contabo/terraform-provider-contabo/blob/main/README.md Use these commands to initialize your Terraform project, plan the changes, and apply them to order resources. Be cautious as `terraform apply` can incur costs. ```sh terraform init terraform plan # CAUTION: with example main.tf you are about to order and pay an object storage terraform apply ``` -------------------------------- ### Configure and Use Contabo Provider Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/index.md This snippet shows how to configure the Contabo provider with your API credentials and create a default Contabo VPS instance. Ensure your API credentials are set correctly in the provider block. ```terraform terraform { required_providers { contabo = { source = "contabo/contabo" version = ">= 0.1.42" } } } # Configure your Contabo API credentials in provider stanza provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Create a default contabo VPS instance resource "contabo_instance" "default_instance" {} # Output our newly created instances output "default_instance_output" { description = "Our first default instance" value = contabo_instance.default_instance } ``` -------------------------------- ### Create a new tag Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_tag.md Create a new tag with a specified color and name. ```terraform resource "contabo_tag" "default_tag" { color = "#000002" name="NewTag" } ``` -------------------------------- ### Configure Contabo Provider and Create Custom Image Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_image.md This snippet shows how to configure the Contabo provider with API credentials and then create a custom image using an Alpine Linux ISO URL. Ensure your API credentials are set correctly in the provider block. ```terraform # Configure your Contabo API credentials in provider stanza provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Create custom image with apline iso resource "contabo_image" "custom_image_alpine" { name = "custom_alpine" image_url = "https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/s390x/alpine-standard-3.13.5-s390x.iso" os_type = "Linux" version = "v3.13.5" description = "custom alpine iso image" } ``` -------------------------------- ### Configure Contabo Provider and Search Instance Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_instance.md Configure your Contabo API credentials using the provider block. Then, use the data source to search for a specific instance by its ID. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } data "contabo_instance" "test_instance" { id = "123455" } output "my_test_instance" { description = "my test instance" value = data.contabo_instance.test_instance } ``` -------------------------------- ### Configure Contabo Provider and Create Private Network Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_private_network.md Configure your Contabo API credentials using the provider block. Then, create a new private network with a specified name, description, region, and associated instance IDs. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Create a new private network resource "contabo_private_network" "databasePrivateNetwork" { name = "terraform-test-private-network" description = "terraform test private network" region = "EU" instance_ids = [42, 1000] } ``` -------------------------------- ### Create a Contabo Instance Snapshot Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_instance_snapshot.md Create a new snapshot for a Contabo instance. You must provide a name, description, and the instance ID. The description can be used to provide more context about the snapshot. ```terraform resource "contabo_instance_snapshot" "snapshotInstance42" { name = "snapshot-of-instance" description = "snapshot of the instance with id 42" instance_id = 42 } ``` -------------------------------- ### contabo_instance Resource Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_instance.md Manages Contabo compute instances (vps/vds). This resource allows for the creation, updating, and management of virtual machines within the Contabo cloud environment. It supports specifying display name, product ID, region, contract period, and custom images. ```APIDOC ## Resource: contabo_instance ### Description Manages Contabo compute instances (vps/vds). This resource allows for the creation, updating, and management of virtual machines within the Contabo cloud environment. It supports specifying display name, product ID, region, contract period, and custom images. ### Arguments * `display_name` - (Required) The display name for the instance. * `product_id` - (Required) The ID of the product that defines the instance's specifications (e.g., "V76", "V92"). * `region` - (Required) The region where the instance will be deployed (e.g., "EU", "US"). * `period` - (Optional) The contract period in months for the instance. Defaults to 1. * `image_id` - (Optional) The ID of a custom image to use for the instance. If not specified, a default image will be used. ### Example Usage ```terraform # Create a new compute instance (vps/vds) in region EU, with specs of the V76 product. Also it has a contract period of 3 month resource "contabo_instance" "database_instance" { display_name = "database" product_id = "V92" region = "EU" period = 3 } # Update custom image on instance resource "contabo_instance" "database_instance" { image_id = contabo_image.custom_image_alpine.id } ``` ``` -------------------------------- ### Configure Contabo Provider with Environment Variables Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/guides/use_environment_variables.md This Terraform configuration sets up the Contabo provider. It requires specific environment variables to be set for authentication, such as CNTB_OAUTH2_CLIENT_ID, CNTB_OAUTH2_CLIENT_SECRET, CNTB_OAUTH2_USER, and CNTB_OAUTH2_PASS. The provider block then uses these environment variables implicitly. ```terraform terraform { required_providers { contabo = { source = "contabo/contabo" version = ">= 0.1.42" } } } provider "contabo" { # Set the following environment variables: # # CNTB_OAUTH2_CLIENT_ID # CNTB_OAUTH2_CLIENT_SECRET # CNTB_OAUTH2_USER # CNTB_OAUTH2_PASS # # and you are good to go oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Create a default contabo VPS instance resource "contabo_instance" "default_instance" {} # Output our newly created instances output "default_instance_output" { description = "Our first default instance" value = contabo_instance.default_instance } ``` -------------------------------- ### Configure Contabo Provider and Create Tag Assignment Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_tag_assignment.md Configure your Contabo API credentials using the provider block. Then, create a new tag assignment by specifying the tag ID, resource type, and resource ID. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } resource "contabo_tag_assignment" "default_tag_assignment" { tag_id = "178478" resource_type = "image" resource_id = "35ee288f-21ea-420c-a074-ce0a968b59c0" } ``` -------------------------------- ### contabo_instance_snapshot Resource Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_instance_snapshot.md This resource allows you to create, configure, and manage snapshots for your Contabo virtual instances using Terraform. You can specify a name, description, and the instance ID for the snapshot. It also supports updating the description of an existing snapshot. ```APIDOC ## Resource: contabo_instance_snapshot ### Description Manages Contabo instance snapshots. ### Usage ```terraform resource "contabo_instance_snapshot" "snapshotInstance42" { name = "snapshot-of-instance" description = "snapshot of the instance with id 42" instance_id = 42 } resource "contabo_instance_snapshot" "snapshotInstance42" { description = "terraform test-snapshot" } ``` ### Schema #### Optional - `created_date` (String) - The creation date of this instance snapshot. - `description` (String) - Description of this snapshot. - `id` (String) - The identifier of the instance snapshot. Use it to manage it! - `instance_id` (Number) - Instance identifier associated with the snapshot. - `name` (String) - Name of the snapshot. #### Read-Only - `auto_delete_date` (String) - The date when the snapshot will be autmatically deleted. - `image_id` (String) - Id of the Image the snapshot was taken from. - `image_name` (String) - Name of the Image the snapshot was taken from. ``` -------------------------------- ### contabo_object_storage_bucket Resource Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_object_storage_bucket.md Manages object storage buckets on Contabo. This resource allows for the creation and configuration of buckets, including setting their name, associating them with an object storage instance, and controlling public sharing. ```APIDOC ## Resource: contabo_object_storage_bucket ### Description Manages buckets on your contabo Object Storage. With this resource you are able to manage your buckets the same way your are able to manage them in your contabo customer panel. ### Schema #### Required - **name** (String) The name of your bucket, consider the naming restriction https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html. - **object_storage_id** (String) The contabo objectStorageId on which the bucket should be created. #### Optional - **public_sharing** (Boolean) Choose the access to your bucket. You can not share it at all or share it publicly. #### Read-Only - **creation_date** (String) The creation date of the bucket. - **id** (String) The identifier of the Object Storage. Use it to manage it! - **public_sharing_link** (String) If your bucket is publicly shared, you can access it with this link. ``` -------------------------------- ### contabo_object_storage_bucket Data Source Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage_bucket.md Search object storage bucket by Object Storage ID and name. ```APIDOC ## contabo_object_storage_bucket (Data Source) ### Description Manage buckets on your contabo Object Storage. With this resource you are able to manage your buckets the same way your are able to manage them in your contabo customer panel. ### Parameters #### Required - `object_storage_id` (String) - The contabo objectStorageId on which the bucket should be created. #### Optional - `name` (String) - The name of your bucket, consider the naming restriction https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html. - `public_sharing` (Boolean) - Choose the access to your bucket. You can not share it at all or share it publicly. ### Read-Only Attributes - `creation_date` (String) - The creation date of the bucket. - `id` (String) - The ID of this resource. - `public_sharing_link` (String) - If your bucket is publicly shared, you can access it with this link. ### Example Usage ```terraform # Configure your Contabo API credentials provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Search object storage bucket by Object Storage ID and name data "contabo_object_storage_bucket" "bucket1" { object_storage_id = "3a6e5301-fc71-42ce-b60c-49841681c2da" name = "testbucket" } output "my_test_bucket" { description = "my test bucket" value = data.contabo_object_storage_bucket.bucket1 } ``` ``` -------------------------------- ### Configure Contabo Provider Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage.md Configure your Contabo API credentials before using the provider. Ensure you have your client ID, client secret, username, and password. ```terraform provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } ``` -------------------------------- ### Run Acceptance Tests for Terraform Provider Source: https://github.com/contabo/terraform-provider-contabo/blob/main/README.md Execute acceptance tests to verify the functionality of the Contabo Terraform provider against actual resources. Ensure you understand that these tests will interact with live resources and may incur costs. ```sh make test-acc ``` -------------------------------- ### Search Object Storage by Display Name Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage.md Retrieve object storage details by its display name using the `contabo_object_storage` data source. This allows for managing storage based on a human-readable identifier. ```terraform # Search object storage by display name data "contabo_object_storage" "example2" { display_name = "example2" } ``` -------------------------------- ### Search Object Storage by ID Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage.md Use the `contabo_object_storage` data source to search for an object storage by its unique ID. This is useful for retrieving specific storage configurations. ```terraform # Search object storage by ID data "contabo_object_storage" "example1" { id = "3a6e5301-fc71-42ce-b60c-49841681c2da" } ``` -------------------------------- ### contabo_object_storage Resource Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_object_storage.md Manages S3 compatible Object Storage. Allows creation, configuration of storage space, and control over autoscaling. Note that this API is not the S3 API itself. ```APIDOC ## contabo_object_storage (Resource) ### Description Manages S3 compatible Object Storage. With the Object Storage API you can create Object Storages in different locations. Please note that you can only have one Object Storage per location. Furthermore, you can increase the amount of storage space and control the autoscaling feature which allows you to automatically perform a monthly upgrade of the disk space to the specified maximum. You might also inspect the usage. This API is not the S3 API itself. For accessing the S3 API directly or with S3 compatible tools like `aws` cli and after having created / upgraded your Object Storage please use the S3 URL from this Storage API and refer to the User Mangement API to retrieve the S3 credentials. ### Schema #### Required - `region` (String) - Region where the Object Storage should be located. Default region is the EU. Following regions are available: `EU`, `US-central`, `SIN`. - `total_purchased_space_tb` (Number) - Amount of purchased / requested object storage in terabyte. #### Optional - `auto_scaling` (Block List) - Configuration for autoscaling. - `error_message` (String) - If the autoscaling is in an error state (see status property), the error message can be seen in this field. - `size_limit_tb` (Number) - Autoscaling size limit for the current object storage. - `state` (String) - Status of this object storage. It can be set to `enabled`, `disabled` or `error`. - `display_name` (String) - Display name for object storage. #### Read-Only - `cancel_date` (String) - The date on which the Object Storage will be cancelled and therefore no longer available. - `created_date` (String) - The creation date of the Object Storage. - `customer_id` (String) - Your customer number. - `data_center` (String) - Data center the object storage is located in. - `id` (String) - The identifier of the Object Storage. Use it to manage it! - `s3_tenant_id` (String) - Your S3 tenant Id. Only required for public sharing. - `s3_url` (String) - S3 URL to connect to your S3 compatible Object Storage. - `status` (String) - The object storage status. It can be set to `PROVISIONING`, `READY`, `UPGRADING`, `CANCELLED`, `ERROR` or `DISABLED`. - `tenant_id` (String) - Your customer tenant Id. ``` -------------------------------- ### Create a new secret Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_secret.md Use this snippet to create a new secret, specifying its name, type, and value. ```terraform resource "contabo_secret" "rootPassword" { name = "my_secret" type = "password" value t = "SmthSecure!1!!" } ``` -------------------------------- ### Contabo Firewall Resource Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_firewall.md This snippet shows how to define and configure a Contabo firewall resource using Terraform. It includes basic settings like name, description, status, and detailed rule configurations for inbound traffic. ```APIDOC ## contabo_firewall Resource ### Description Manages a Contabo firewall. ### Schema #### Required - `name` (String) The name of the Firewall. It may contain letters, numbers, colons, dashes, and underscores. There is a limit of 255 characters per Firewall name. - `status` (String) Status of the Firewall. It can be `active`, or `inactive`. #### Optional - `created_date` (String) The creation date of the Firewall. - `description` (String) The description of the Firewall. There is a limit of 255 characters per Firewall. - `instance_ids` (Set of Number) Add the instace Ids to the firewall here. If you do not add any instance Ids an empty firewall will be created. - `instances_status` (Block List) The status of every instance in the firewall. - `error_message` (String) Status of the instance. - `instance_id` (Number) The instance. - `status` (String) Status of the instance. - `rules` (Block List) Rules for this Firewall. - `inbound` (Block List) Inbound rules for this Firewall. - `action` (String) Action of the rule, currently there is just `accept`. - `dest_ports` (Set of String) - `protocol` (String) Define the protocol for the rule. Allowed protocols are `tcp`, `udp` and `icmp`. - `src_cidr` (Block List) Source CIDR for the rule. - `ipv4` (Set of String) Provide allowed IPv4 addresses as string array for this rule - `ipv6` (Set of String) Provide allowed IPv6 addresses as string array for this rule - `status` (String) Status of the rule. It can be `active`, or `inactive`. ### Read-Only - `id` (String) The identifier of the Firewall. Use it to manage it! ``` -------------------------------- ### contabo_instance Data Source Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_instance.md The `contabo_instance` data source allows you to search for a specific Contabo instance by its ID. This is useful for retrieving details about an existing instance to use in other parts of your Terraform configuration. ```APIDOC ## contabo_instance (Data Source) ### Description The Compute Management API allows you to manage compute resources (e.g. creation, deletion, starting, stopping) as well as managing snapshots and custom images. It also supports [cloud-init](https://cloud-init.io/) at least on our default images (for custom images you will need to provide cloud-init support packages). The API offers providing cloud-init scripts via the user_data field. Custom images must be provided in .qcow2 or .iso format. ### Example Usage ```terraform # Configure your Contabo API credentials provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Search for a specific instance by ID data "contabo_instance" "test_instance" { id = "123455" } output "my_test_instance" { description = "my test instance" value = data.contabo_instance.test_instance } ``` ### Parameters #### Query Parameters - **id** (string) - Required - The ID of the instance to retrieve. ``` -------------------------------- ### Output Object Storage Information Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage.md Outputs the retrieved object storage information. This is helpful for verifying the data source configuration and accessing storage details in subsequent resources. ```terraform output "my_object_storage1" { description = "my object storage 1" value = data.contabo_object_storage.example1 } output "my_object_storage2" { description = "my object storage 2" value = data.contabo_object_storage.example1 } ``` -------------------------------- ### contabo_private_network Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_private_network.md Provides a Contabo Private Network data source. Private Networks can contain your compute instances whereby they are able to communicate with each other in full usolation, using private IP addresses. ```APIDOC ## contabo_private_network (Data Source) ### Description Provides a Contabo [Private Network](https://api.contabo.com/#tag/Private-Networks) data source. Private Networks can contain your compute instances whereby they are able to communicate with each other in full usolation, using private IP addresses. ### Parameters #### Required - `id` (String) - The identifier of the Private Network. Use it to manage it! #### Optional - `created_date` (String) - The creation date of the Private Network. - `description` (String) - The description of the Private Network. There is a limit of 255 characters per Private Network. - `instance_ids` (Set of Number) - Add the instace Ids to the private network here. If you do not add any instance Ids an empty private network will be created. - `name` (String) - The name of the Private Network. It may contain letters, numbers, colons, dashes, and underscores. There is a limit of 255 characters per Private Network name. - `region` (String) - The region where the Private Network should be located. Default region is the EU. - `region_name` (String) - The name of the region where the Private Network is located. - `updated_at` (String) - Time of the last update of the private network. ### Read-Only Attributes - `available_ips` (Number) - The totality of available IPs in the Private Network. - `cidr` (String) - The cidr range of the Private Network. - `data_center` (String) - The specific data center where the Private Network is located. - `instances` (List of Object) - Details about instances within the private network. - `display_name` (String) - `error_message` (String) - `instance_id` (String) - `name` (String) - `private_ip_config` (List of Object) - `v4` (List of Object) - `gateway` (String) - `ip` (String) - `netmask_cidr` (Number) ### Example Usage ```terraform # Configure your Contabo API credentials provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Search for a specific private network by ID data "contabo_private_network" "testnetwork" { id = "1234" } output "my_test_private_network" { description = "my test private network" value = data.contabo_private_network.testnetwork } ``` ``` -------------------------------- ### Update Object Storage with Autoscaling Enabled Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_object_storage.md Update an existing object storage instance to enable autoscaling. This allows the storage to automatically scale up to a specified limit (5TB in this case). ```terraform resource "contabo_object_storage" "object_storage_eu" { auto_scaling { state = "enabled" size_limit_tb = 5 } } ``` -------------------------------- ### contabo_instance_snapshot Data Source Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_instance_snapshot.md Retrieves details for a Contabo instance snapshot. You can search by snapshot ID, instance ID, name, or description. ```APIDOC ## Data Source: contabo_instance_snapshot ### Description This data source allows you to fetch information about a Contabo instance snapshot. It can be identified by its unique ID, or by associating it with an instance ID, name, or description. ### Usage ```terraform data "contabo_instance_snapshot" "example" { id = "66abf39a-ba8b-425e-a385-8eb347ceac10" # instance_id = "your_instance_id" # name = "your_snapshot_name" # description = "your_snapshot_description" } ``` ### Arguments #### Required - **id** (String) The unique identifier of the instance snapshot. #### Optional - **description** (String) A description of the snapshot. - **instance_id** (String) The identifier of the instance associated with the snapshot. - **name** (String) The name of the snapshot. ### Attributes #### Read-Only - **auto_delete_date** (String) The date when the snapshot will be automatically deleted. - **created_date** (String) The creation date of the instance snapshot. - **image_id** (String) The ID of the image from which the snapshot was taken. - **image_name** (String) The name of the image from which the snapshot was taken. ``` -------------------------------- ### Update an existing tag Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/resources/contabo_tag.md Update an existing tag by providing a new color and name. The resource block is reused for updates. ```terraform resource "contabo_tag" "default_tag" { color = "#ffffff" name = "UpdatedTag" } ``` -------------------------------- ### contabo_object_storage Data Source Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_object_storage.md The Contabo Object Storage data source allows you to search for existing object storage instances by their ID or display name. This is useful for retrieving details about your object storage, such as its S3 URL, status, and capacity, to be used in other Terraform resources or outputs. ```APIDOC ## Data Source: contabo_object_storage ### Description Manage S3 compatible Object Storage. With the Object Storage API you can create Object Storages in different locations. Please note that you can only have one Object Storage per location. Furthermore, you can increase the amount of storage space and control the autoscaling feature which allows you to automatically perform a monthly upgrade of the disk space to the specified maximum. You might also inspect the usage. This API is not the S3 API itself. For accessing the S3 API directly or with S3 compatible tools like `aws` cli and after having created / upgraded your Object Storage please use the S3 URL from this Storage API and refer to the User Mangement API to retrieve the S3 credentials. ### Example Usage ```terraform # Configure your Contabo API credentials provider "contabo" { oauth2_client_id = "[your client id]" oauth2_client_secret = "[your client secret]" oauth2_user = "[your username]" oauth2_pass = "[your password]" } # Search object storage by ID data "contabo_object_storage" "example1" { id = "3a6e5301-fc71-42ce-b60c-49841681c2da" } # Search object storage by display name data "contabo_object_storage" "example2" { display_name = "example2" } output "my_object_storage1" { description = "my object storage 1" value = data.contabo_object_storage.example1 } output "my_object_storage2" { description = "my object storage 2" value = data.contabo_object_storage.example1 } ``` ### Schema ### Optional - `auto_scaling` (Block List) (see [below for nested schema](#nestedblock--auto_scaling)) - `display_name` (String) Display name for object storage. Use it to manage it! - `id` (String) The identifier of the Object Storage. Use it to manage it! ### Read-Only - `cancel_date` (String) The date on which the Object Storage will be cancelled and therefore no longer available. - `created_date` (String) The creation date of the Object Storage. - `customer_id` (String) Your customer number. - `data_center` (String) Data center the object storage is located in. - `region` (String) Region where the Object Storage should be located. Default region is the EU. Following regions are available: `EU`,`US-central`, `SIN`. - `s3_tenant_id` (String) Your S3 tenant Id. Only required for public sharing. - `s3_url` (String) S3 URL to connect to your S3 compatible Object Storage. - `status` (String) The object storage status. It can be set to `PROVISIONING`,`READY`,`UPGRADING`,`CANCELLED`,`ERROR` or `DISABLED`. - `tenant_id` (String) Your customer tenant Id. - `total_purchased_space_tb` (Number) Amount of purchased / requested object storage in terabyte. ### Nested Schema for `auto_scaling` Optional: - `error_message` (String) If the autoscaling is in an error state (see status property), the error message can be seen in this field. - `size_limit_tb` (Number) Autoscaling size limit for the current object storage. - `state` (String) Status of this object storage. It can be set to `enabled`, `disabled` or `error`. ``` -------------------------------- ### contabo_image Data Source Source: https://github.com/contabo/terraform-provider-contabo/blob/main/docs/data-sources/contabo_image.md This data source allows you to retrieve information about Contabo custom images. You can search for an image by its ID and access various metadata such as its creation date, status, format, and size. ```APIDOC ## contabo_image Data Source ### Description This data source can be used to manage Contabo custom images. In order to provide a custom image, please specify an URL from which the image can be downloaded directly. A custom image must be in either `.iso` or `.qcow2` format. Other formats will be rejected. Please note that downloading can take a while depending on network speed resp. bandwidth and size of image. You can check the status by retrieving information about the image via a GET request. Download will be rejected if you have exceeded your limits. ### Schema #### Required - `id` (String) The identifier of the image. Use it to manage it! #### Optional - `description` (String) Description of the image. #### Read-Only - `creation_date` (String) The creation date of the image. - `error_message` (String) If the image is in an error state (see status property), the error message can be seen in this field. - `format` (String) Format of your image `iso` or `qcow`. - `last_updated` (String) Time of the last update of the image. - `name` (String) Name of the image. - `os_type` (String) Provided type of operating system (OS). Please specify Windows for MS `Windows` and `Linux` for other OS. Specifying wrong OS type may lead to disfunctional cloud instance. - `standard_image` (Boolean) Flag indicating that the image is either a standard (true) or a custom image (false). - `status` (String) Downloading status of the image (`downloading`, `downloaded` or `error`). - `uploaded_size_mb` (Number) The size of the uploaded image in megabyte. - `version` (String) Version number to distinguish the contents of an image e.g. the version of the operating system. ```