Git Product home page Git Product logo

terraform-provider-ionoscloud's Introduction

Gitter Quality Gate Status Bugs Maintainability Rating Reliability Rating Security Rating Vulnerabilities Release Release Date Compute-engine test run Go

Alt text

IONOS Cloud Terraform Provider

The IonosCloud provider gives the ability to deploy and configure resources using the IonosCloud APIs.

Migrating from the ProfitBricks provider

Please see the Documentation on how to migrate from the ProfitBricks provider.

Requirements

  • Terraform 0.12.x+
  • Go 1.20+ (to build the provider plugin)

NOTE: In order to use a specific version of this provider, please include the following block at the beginning of your terraform config files details:

provider "ionoscloud" {
  version = "~> 6.3.0"
}

Building The Provider

Clone repository to: $GOPATH/src/github.com/ionos-cloud/terraform-provider-ionoscloud

$ mkdir -p $GOPATH/src/github.com/ionos-cloud; cd $GOPATH/src/github.com/ionos-cloud
$ git clone https://github.com/ionos-cloud/terraform-provider-ionoscloud.git

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/ionos-cloud/terraform-provider-ionoscloud
$ make build

Using the provider

See the IonosCloud Provider documentation to get started using the IonosCloud provider.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.20+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
...
$ $GOPATH/bin/terraform-provider-ionoscloud
...

Testing the Provider

What Are We Testing?

The purpose of our acceptance tests is to provision resources containing all the available arguments, followed by updates on all arguments that allow this action. Beside the provisioning part, data-sources with all possible arguments and imports are also tested.

All tests are integrated into github actions that run daily and are also run manually before any release.

How to Run Tests Locally

⚠️ Warning: Acceptance tests provision resources in the IONOS Cloud, and often may involve extra billing charges on your account.

In order to test the provider, you can simply run:

$ make test

In order to run the full suite of Acceptance tests, run:

$ make testacc TAGS=all

Test Tags

Tests can also be run for a batch of resources or for a single resource, using tags.

Example of running server and lan tests:

$ make testacc TAGS=server,lan
See more details about test tags

Build tags are named as follows:

  • compute - all compute engine tests (datacenter, firewall rule, image, IP block, IP failover, lan, location, nic, private cross connect, server, snapshot, template, volume)
  • nlb - network load balancer and network load balancer forwarding rule tests
  • natgateway - NAT gateway and NAT gateway rule tests
  • k8s - k8s cluster and k8s node pool tests
  • dbaas - DBaaS postgres cluster tests
  • alb - Application Load Balancer tests
$ make testacc TAGS=dbaas

You can also test one single resource, using one of the tags: backup, datacenter, dbaas, firewall, group, image, ipblock, ipfailover, k8s, lan, location, natgateway, nlb, nic, pcc, resource, s3key, server, share, snapshot, template, user, volume

Certificate pinning:

You can enable certificate pinning if you want to bypass the normal certificate checking procedure, by doing the following:

Set env variable IONOS_PINNED_CERT=<insert_sha256_public_fingerprint_here>

You can get the sha256 fingerprint most easily from the browser by inspecting the certificate.

Debugging

In the default mode, the Terraform provider returns only HTTP client errors. These usually consist only of the HTTP status code. There is no clear description of the problem. But if you want to see the API call error messages as well, you need to set the SDK and Terraform provider environment variables.

You can enable logging now using the IONOS_LOG_LEVEL env variable. Allowed values: off, debug and trace. Defaults to off.

⚠️ Note: We recommend you only use trace level for debugging purposes. Disable it in your production environments because it can log sensitive data. It logs the full request and response without encryption, even for an HTTPS call. Verbose request and response logging can also significantly impact your application’s performance.

$ export IONOS_LOG_LEVEL=debug

⚠️ Note: IONOS_DEBUG is now deprecated and will be removed in a future release.

⚠️ Note: We recommend you only use IONOS_DEBUG for debugging purposes. Disable it in your production environments because it can log sensitive data. It logs the full request and response without encryption, even for an HTTPS call. Verbose request and response logging can also significantly impact your application’s performance.

$ export TF_LOG=debug
$ export IONOS_DEBUG=true
$ terraform apply

now you can see the response body incl. api error message:

{
  "httpStatus" : 422,
  "messages" : [ {
    "errorCode" : "200",
    "message" : "[VDC-yy-xxxx] Operation cannot be executed since this Kubernetes Nodepool is already marked for deletion. Current state of the resource is FAILED_DESTROYING."
  }]
}

terraform-provider-ionoscloud's People

Contributors

cristiguranionos avatar iblindu avatar adeatcu-ionos avatar liviusp avatar gabriel-savu avatar morheu-ionos avatar mflorin avatar avirtopeanu-ionos avatar dsertionos avatar ikukschtel avatar jwoschitz avatar lpirvanescu-ionos avatar dependabot[bot] avatar dreamblack86 avatar gohumble avatar philipwelz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.