This guide lists the configuration for 'openapi' Terraform provider resources that can be managed using Terraform v0.12

Provider Installation

In order to provision 'openapi' Terraform resources, you need to first install the 'openapi' Terraform plugin by running the following command (you must be running Terraform >= 0.12):

$ export PROVIDER_NAME=openapi && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME
[INFO] Downloading https://github.com/dikhan/terraform-provider-openapi/v2/releases/download/v0.29.4/terraform-provider-openapi_0.29.4_darwin_amd64.tar.gz in temporally folder /var/folders/n_/1lrwb99s7f50xmn9jpmfnddh0000gp/T/tmp.Xv1AkIZh...
[INFO] Extracting terraform-provider-openapi from terraform-provider-openapi_0.29.4_darwin_amd64.tar.gz...
[INFO] Cleaning up tmp dir created for installation purposes: /var/folders/n_/1lrwb99s7f50xmn9jpmfnddh0000gp/T/tmp.Xv1AkIZh
[INFO] Terraform provider 'terraform-provider-openapi' successfully installed at: '~/.terraform.d/plugins'!

You can then start running the Terraform provider:

$ export OTF_VAR_openapi_PLUGIN_CONFIGURATION_FILE="https://api.service.com/openapi.yaml"
➜ ~ terraform init && terraform plan

Note: As of Terraform >= 0.13 each Terraform module must declare which providers it requires, so that Terraform can install and use them. If you are using Terraform >= 0.13, copy into your .tf file the following snippet already populated with the provider configuration:

terraform {
  required_providers {
    openapi = {
      source  = "terraform.example.com/examplecorp/openapi"
      version = ">= 2.0.1" 
    }
  }
}

Provider Configuration

Example Usage

provider "openapi" {
  apikey_auth  = "..."
  x_request_id  = "..."
}

Using the default region (rst1):

provider "openapi" {
  # Resources using this default provider will be created in the 'rst1' region
...
}

Using a specific region (dub1):

provider "openapi" {
  alias  = "dub1"
  region = "dub1"
...
}
resource"openapi_resource" "my_resource" { provider = "openapi.dub1"
...
}

Arguments Reference

The following arguments are supported:

Provider Resources

openapi_cdn_v1

Example usage

resource "openapi_cdn_v1" "my_cdn_v1"{
    hostnames  = ["hostnames1", "hostnames2"]
    label  = "label"
    ips  = ["ips1", "ips2"]
}

Arguments Reference

The following arguments are supported:

* Note: Object type properties are internally represented (in the state file) as a list of one elem due to Terraform SDK's limitation for supporting complex object types. Please index on the first elem of the array to reference the object values (eg: openapi_cdn_v1.my_cdn_v1.object_property[0].object_property)

Attributes Reference

In addition to all arguments above, the following attributes are exported:

* Note: Object type properties are internally represented (in the state file) as a list of one elem due to Terraform SDK's limitation for supporting complex object types. Please index on the first elem of the array to reference the object values (eg: openapi_cdn_v1.my_cdn_v1.object_property[0].object_property)

Import

cdn_v1 resources can be imported using the id , e.g:

$ terraform import openapi_cdn_v1.my_cdn_v1 id

Note: In order for the import to work, the 'openapi' terraform provider must be properly installed. Read more about Terraform import usage here.

openapi_cdn_v1_firewalls_v1

Example usage

resource "openapi_cdn_v1_firewalls_v1" "my_cdn_v1_firewalls_v1"{
    name  = "name"
    cdn_v1_id  = "cdn_v1_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

cdn_v1_firewalls_v1 resources can be imported using the id . This is a sub-resource so the parent resource IDs ([cdn_v1_id]) are required to be able to retrieve an instance of this resource, e.g:

$ terraform import openapi_cdn_v1_firewalls_v1.my_cdn_v1_firewalls_v1 cdn_v1_id/cdn_v1_firewalls_v1_id

Note: In order for the import to work, the 'openapi' terraform provider must be properly installed. Read more about Terraform import usage here.

openapi_lbs_v1

Example usage

resource "openapi_lbs_v1" "my_lbs_v1"{
    name  = "name"
    backends  = ["backends1", "backends2"]
}

Arguments Reference

The following arguments are supported:

* Note: Object type properties are internally represented (in the state file) as a list of one elem due to Terraform SDK's limitation for supporting complex object types. Please index on the first elem of the array to reference the object values (eg: openapi_lbs_v1.my_lbs_v1.new_status[0].object_property)

Attributes Reference

In addition to all arguments above, the following attributes are exported:

* Note: Object type properties are internally represented (in the state file) as a list of one elem due to Terraform SDK's limitation for supporting complex object types. Please index on the first elem of the array to reference the object values (eg: openapi_lbs_v1.my_lbs_v1.new_status[0].object_property)

Import

lbs_v1 resources can be imported using the id , e.g:

$ terraform import openapi_lbs_v1.my_lbs_v1 id

Note: In order for the import to work, the 'openapi' terraform provider must be properly installed. Read more about Terraform import usage here.

openapi_monitors_v1_dub1

Example usage

resource "openapi_monitors_v1_dub1" "my_monitors_v1_dub1"{
    name  = "name"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

monitors_v1_dub1 resources can be imported using the id , e.g:

$ terraform import openapi_monitors_v1_dub1.my_monitors_v1_dub1 id

Note: In order for the import to work, the 'openapi' terraform provider must be properly installed. Read more about Terraform import usage here.

openapi_monitors_v1_rst1

Example usage

resource "openapi_monitors_v1_rst1" "my_monitors_v1_rst1"{
    name  = "name"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

monitors_v1_rst1 resources can be imported using the id , e.g:

$ terraform import openapi_monitors_v1_rst1.my_monitors_v1_rst1 id

Note: In order for the import to work, the 'openapi' terraform provider must be properly installed. Read more about Terraform import usage here.

openapi_multiregionmonitors_v1

Example usage

resource "openapi_multiregionmonitors_v1" "my_multiregionmonitors_v1"{
    name  = "name"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

multiregionmonitors_v1 resources can be imported using the id , e.g:

$ terraform import openapi_multiregionmonitors_v1.my_multiregionmonitors_v1 id

Note: In order for the import to work, the 'openapi' terraform provider must be properly installed. Read more about Terraform import usage here.

Data Sources (using resource id)

openapi_cdn_v1_firewalls_v1_instance

Retrieve an existing resource using it's ID

Example usage

data "openapi_cdn_v1_firewalls_v1_instance" "my_cdn_v1_firewalls_v1_instance"{
    id = "existing_resource_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

openapi_cdn_v1_instance

Retrieve an existing resource using it's ID

Example usage

data "openapi_cdn_v1_instance" "my_cdn_v1_instance"{
    id = "existing_resource_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

* Note: Object type properties are internally represented (in the state file) as a list of one elem due to Terraform SDK's limitation for supporting complex object types. Please index on the first elem of the array to reference the object values (eg: openapi_cdn_v1_instance.my_cdn_v1_instance.object_nested_scheme_property[0].object_property)

openapi_lbs_v1_instance

Retrieve an existing resource using it's ID

Example usage

data "openapi_lbs_v1_instance" "my_lbs_v1_instance"{
    id = "existing_resource_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

* Note: Object type properties are internally represented (in the state file) as a list of one elem due to Terraform SDK's limitation for supporting complex object types. Please index on the first elem of the array to reference the object values (eg: openapi_lbs_v1_instance.my_lbs_v1_instance.new_status[0].object_property)

openapi_monitors_v1_dub1_instance

Retrieve an existing resource using it's ID

Example usage

data "openapi_monitors_v1_dub1_instance" "my_monitors_v1_dub1_instance"{
    id = "existing_resource_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

openapi_monitors_v1_rst1_instance

Retrieve an existing resource using it's ID

Example usage

data "openapi_monitors_v1_rst1_instance" "my_monitors_v1_rst1_instance"{
    id = "existing_resource_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

openapi_multiregionmonitors_v1_instance

Retrieve an existing resource using it's ID

Example usage

data "openapi_multiregionmonitors_v1_instance" "my_multiregionmonitors_v1_instance"{
    id = "existing_resource_id"
}

Arguments Reference

The following arguments are supported:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Data Sources (using filters)

No data sources using filters are supported at the moment.