Code Monkey home page Code Monkey logo

terraform-provider-opentelekomcloud's Introduction

Terraform logo

Terraform Open Telekom Cloud Provider

Documentation

Quick Start

When using the OpenTelekomCloud Provider with Terraform 0.13 and later, the recommended approach is to declare Provider versions in the root module Terraform configuration, using a required_providers block as per the following example. For previous versions, please continue to pin the version within the provider block.

  1. Add opentelekomcloud/opentelekomcloud to your required_providers.
# provider.tf
terraform {
   required_providers {
      opentelekomcloud = {
         source = "opentelekomcloud/opentelekomcloud"
         version = ">= 1.23.2"
      }
   }
}
  1. Run terraform init -upgrade to download the provider.
  2. Add the provider and supply your tenant_name and domain_name for minimum configuration.
# provider.tf
provider "opentelekomcloud" {
   # OpenTelekomCloud Provider Documentation:
   # https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest/docs
   # domain_name = "..."
   # tenant_name = "..."
   # auth_url    = "https://iam.eu-de.otc.t-systems.com/v3"
   # user_name   = "..."
   # password    = "..."
}
  1. Authenticate either by providing user_name and password in the previous file or setting them as environment variables.
# Linux
OS_USERNAME="<your_username>"
OS_PASSWORD="<your_password"
# Windows
$env:OS_USERNAME="<your_username>"
$env:OS_PASSWORD="<your_password"
  1. Create your first resource.
# main.tf

# Create an Elastic Cloud Server resource
resource "opentelekomcloud_compute_instance_v2" "debian_ecs" {
   name        = "debian_ecs"
   image_name  = "Standard_Debian_11_latest"
   flavor_name = "s3.medium.1"

   key_pair        = "kp_ecs"
   security_groups = ["default"]
   network {
      name = "network_ecs"
   }
}

Full Examples

Don't forget to fill in the required variables.

Developing the Provider

See Contribution Guide for the details.

Requirements

  • Terraform 0.13+ (but 1.x is recommended)
  • Go 1.16.x (to build the provider plugin)

Building The Provider

Clone repository to: $GOPATH/src/github.com/opentelekomcloud/terraform-provider-opentelekomcloud

$ export GO111MODULE=on
$ go get github.com/opentelekomcloud/terraform-provider-opentelekomcloud

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/opentelekomcloud/terraform-provider-opentelekomcloud
$ make build

To compile the provider, run make build. This will build the provider and put the provider binary in the current directory.

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

In order to test the provider, you can simply run make test.

$ make test

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run.

$ make testacc

terraform-provider-opentelekomcloud's People

Contributors

anton-sidelnikov avatar appilon avatar artem-lifshits avatar dependabot[bot] avatar dombisza avatar dupuy avatar fatmcgav avatar freesky-edward avatar garyxia avatar ggiamarchi avatar grubernaut avatar jrperritt avatar jtopjian avatar julienvey avatar khdegraaf avatar lego963 avatar mcanevet avatar mitchellh avatar niuzhenguo avatar outcatcher avatar paultyng avatar radeksimko avatar shaderecker avatar sheile avatar shichangkuo avatar stack72 avatar takaishi avatar vladimirvshivkov avatar zengchen1024 avatar zhongjun2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-opentelekomcloud's Issues

[doc] two incorrect parameters description

there are some documentation issues that are incorrect.

  1. the notification_list in opentelekomcloud_ces_alarmrule should be required.
  2. the connection_limit in opentelekomcloud_lb_listener_v2 is invalid

Terraform Version

any

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_ces_alarmrule
  • opentelekomcloud_lb_listener_v2

Terraform Configuration Files

any

Debug Output

none

Panic Output

none

Expected Behavior

all the parameters in doc should be right.

Actual Behavior

some of them are not correct.

Important Factoids

this will lead user to use it incorrectly

References

none

OTC provider crashes with networking_subnet_v2 module

Terraform Version

Terraform v0.11.7
+ provider.opentelekomcloud v1.0.0

Affected Resource(s)

  • opentelekomcloud_networking_subnet_v2

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

https://pastebin.com/h9vDPbVk

Debug Output

https://gist.github.com/Moep90/1ed2154aa1fd1662d4d5f4e7a7301ade

Expected Behavior

Terraform should be able to create all resources as described

Actual Behavior

terraform crashes with:

Error: Error applying plan:

4 error(s) occurred:

* opentelekomcloud_networking_subnet_v2.public_subnet_zone2: 1 error(s) occurred:

* opentelekomcloud_networking_subnet_v2.public_subnet_zone2: Error creating OpenTelekomCloud networking client: No suitable endpoint could be found in the service catalog.
* opentelekomcloud_networking_subnet_v2.public_subnet_zone1: 1 error(s) occurred:

* opentelekomcloud_networking_subnet_v2.public_subnet_zone1: Error creating OpenTelekomCloud networking client: No suitable endpoint could be found in the service catalog.
* opentelekomcloud_networking_subnet_v2.private_subnet_zone1: 1 error(s) occurred:

2018-04-30T16:42:26.057+0200 [DEBUG] plugin: plugin process exited: path=/home/danny/git-repos/terraform-nexboard/.terraform/plugins/linux_amd64/terraform-provider-opentelekomcloud_v1.0.0_x4
* opentelekomcloud_networking_subnet_v2.private_subnet_zone1: Error creating OpenTelekomCloud networking client: No suitable endpoint could be found in the service catalog.
* opentelekomcloud_networking_subnet_v2.private_subnet_zone2: 1 error(s) occurred:

* opentelekomcloud_networking_subnet_v2.private_subnet_zone2: Error creating OpenTelekomCloud networking client: No suitable endpoint could be found in the service catalog.

Steps to Reproduce

  1. terraform init
  2. terraform apply

ECS resource failed "resizing" when changing the Instance flavor

Hi there,

I just spon up 6 instances with flavor_name: s2.xlarge.2 after that I wanted to change the flavor to h1.4xlarge.4 expecting to recreate or shutdown and resize it, instead it fails not get instances to correct state.

Terraform Version

terraform -v
Terraform v0.11.10
+ provider.local v1.1.0
+ provider.null v1.0.0
+ provider.opentelekomcloud v1.3.0
+ provider.random v2.0.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_compute_instance_v2

Terraform Configuration Files

Instance creation:

resource "opentelekomcloud_compute_instance_v2" "ecs_instance" {
[...]
  image_name        = "${var.ecs_image_name}"
  flavor_name       = "s2.xlarge.2"
[...]

  metadata {
[...]
  }

  block_device {
    uuid                  = "${data.opentelekomcloud_images_image_v2.ecs_image_data.id}"
    source_type           = "image"
    boot_index            = 0
    destination_type      = "local"
    delete_on_termination = "${var.delete_on_termination}"
  }

  network {
[...]
  }

}

Instance resizing:

resource "opentelekomcloud_compute_instance_v2" "ecs_instance" {
[...]
  image_name        = "${var.ecs_image_name}"
  flavor_name       = "h1.4xlarge.4"
[...]

  metadata {
[...]
  }

  block_device {
    uuid                  = "${data.opentelekomcloud_images_image_v2.ecs_image_data.id}"
    source_type           = "image"
    boot_index            = 0
    destination_type      = "local"
    delete_on_termination = "${var.delete_on_termination}"
  }

  network {
[...]
  }

}

Debug Output

https://gist.github.com/Moep90/78d569ab08df7f0a83b6ce5a16df2d3a

Error Output

6 error(s) occurred:

* module.[...].opentelekomcloud_compute_instance_v2.ecs_instance[2]: 1 error(s) occurred:

* opentelekomcloud_compute_instance_v2.ecs_instance.2: Error waiting for instance (f38eeb9e-63f6-4852-960a-5d8bb44e7a98) to resize: unexpected state 'SHUTOFF', wanted target 'VERIFY_RESIZE'. last error: %!s(<nil>)
* module.[...].opentelekomcloud_compute_instance_v2.ecs_instance[3]: 1 error(s) occurred:

* opentelekomcloud_compute_instance_v2.ecs_instance.3: Error waiting for instance (f25b9e7f-0756-4252-9845-0eac8cde56ec) to resize: unexpected state 'SHUTOFF', wanted target 'VERIFY_RESIZE'. last error: %!s(<nil>)
* module.[...].opentelekomcloud_compute_instance_v2.ecs_instance[5]: 1 error(s) occurred:

[...]

Expected Behavior

Expection 1.)
The instances are shut down and beeing restarted when new flavor (resize) happened.
Expection 2.)
Or the instances got replaced with the new flavor.

Actual Behavior

Got unexpected state:
When shut off: unexpected state 'SHUTOFF', wanted target 'VERIFY_RESIZE'
When running: unexpected state '(RUNNING or READY), wanted target 'VERIFY_RESIZE' when changing flavor of provisioned instances.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Unable to create router and nat gateway.

Hi,

I am trying to create networking components using terraform template. I have created VPC and subnets. I need to create Load Balancer, router and Nat gateway to have Internet access. In the router, I saw the component as "external gateway" but I didnt find any resource which can be used to create external gateway.
I saw the snippet for NAT gateway, it requires router_id and snippet for router requires external gateway. I don't know how to create or get details for external gateway.

Any suggestion here would be very helpful.

Thanks,
Reena

[REQUEST] Add support for Cloud_container_engine (CCE)

It would be so nice to be enabled to use kubernetes of the OTC
Since this seams to be one of their main features....

Terraform Version

terraform -v
Terraform v0.11.8
+ provider.kubernetes v1.3.0
+ provider.opentelekomcloud v1.3.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_cce

Expected Behavior

I'm enabled to use the CCE feature and provision a Kubernetes Cluster within the OTC

Actual Behavior

There is either an Openstack nor a OTC module to use this feature

Release 1.6.1 not working ("No suitable endpoint could be found in the service catalog.")

Hello,

working with latest OTC plugin (v1.6.1) a "terraform apply" is running into the following error:

...
Error: Error applying plan:

2 error(s) occurred:

* opentelekomcloud_networking_router_v2.router: 1 error(s) occurred:

* opentelekomcloud_networking_router_v2.router: Error creating OpenTelekomCloud networking cl                                                          ient: No suitable endpoint could be found in the service catalog.
* opentelekomcloud_compute_keypair_v2.new_keypair: 1 error(s) occurred:

* opentelekomcloud_compute_keypair_v2.new_keypair: Error creating OpenTelekomCloud compute cl                                                          ient: No suitable endpoint could be found in the service catalog.

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Terraform Version

v0.11.7

Affected Resource(s)

Terraform provider OTC plugin v1.6.1

Terraform Configuration Files

variable "project" {
  default = "test"
}

variable "endpoint" {
  default = "https://iam.eu-de.otc.t-systems.com:443/v3"
}

provider "opentelekomcloud" {
  ...
  auth_url    = "${var.endpoint}"
}

resource "opentelekomcloud_networking_router_v2" "router" {
  name                = "${var.project}-vpc"
  admin_state_up      = "true"
}

Other necessary stuff (user, password, tenant, domain, ...) you have to set by your own.

Debug Output

no debug output

Panic Output

no panic output

Expected Behavior

Ressource (a simple VPC in the given example) should be created.

Actual Behavior

Running into an error message. Ressource is not created.
See "Steps to Reproduce".

Steps to Reproduce

[mschelln@gw:~]$ terraform init

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "opentelekomcloud" (1.6.1)...
- Downloading plugin for provider "openstack" (1.16.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.openstack: version = "~> 1.16"
* provider.opentelekomcloud: version = "~> 1.6"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
[mschelln@gw:~]$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + opentelekomcloud_networking_router_v2.router
      id:             <computed>
      admin_state_up: "true"
      distributed:    <computed>
      enable_snat:    <computed>
      name:           "test-vpc"
      region:         <computed>
      tenant_id:      <computed>


Plan: 1 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

[mschelln@gw:~]$ terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + opentelekomcloud_networking_router_v2.router
      id:             <computed>
      admin_state_up: "true"
      distributed:    <computed>
      enable_snat:    <computed>
      name:           "test-vpc"
      region:         <computed>
      tenant_id:      <computed>


Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

opentelekomcloud_networking_router_v2.router: Creating...
  admin_state_up: "" => "true"
  distributed:    "" => "<computed>"
  enable_snat:    "" => "<computed>"
  name:           "" => "test-vpc"
  region:         "" => "<computed>"
  tenant_id:      "" => "<computed>"

Error: Error applying plan:

1 error(s) occurred:

* opentelekomcloud_networking_router_v2.router: 1 error(s) occurred:

* opentelekomcloud_networking_router_v2.router: Error creating OpenTelekomCloud networking client: No suitable endpoint could be found in the service catalog.

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


[mschelln@gw:~]$

Important Factoids

Using v1.6.0 of OTC provider plugin instead, it is working.

Just set it up:

provider "opentelekomcloud" {
  ...
  auth_url    = "${var.endpoint}"
  version     = "1.6.0"
}

And afterwards give it a try:

[mschelln@gw:~]$ rm -rf .terraform
[mschelln@gw:~]$ terraform init

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "openstack" (1.16.0)...
- Downloading plugin for provider "opentelekomcloud" (1.6.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.openstack: version = "~> 1.16"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
[mschelln@gw:~]$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + opentelekomcloud_networking_router_v2.router
      id:             <computed>
      admin_state_up: "true"
      distributed:    <computed>
      enable_snat:    <computed>
      name:           "test-vpc"
      region:         <computed>
      tenant_id:      <computed>


Plan: 1 to add, 0 to change, 0 to destroy.

------------------------------------------------------------------------

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

[mschelln@gw:~]$ terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + opentelekomcloud_networking_router_v2.router
      id:             <computed>
      admin_state_up: "true"
      distributed:    <computed>
      enable_snat:    <computed>
      name:           "test-vpc"
      region:         <computed>
      tenant_id:      <computed>


Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

opentelekomcloud_networking_router_v2.router: Creating...
  admin_state_up: "" => "true"
  distributed:    "" => "<computed>"
  enable_snat:    "" => "<computed>"
  name:           "" => "test-vpc"
  region:         "" => "<computed>"
  tenant_id:      "" => "<computed>"
opentelekomcloud_networking_router_v2.router: Creation complete after 7s (ID: 20c2e110-f063-478b-9e4d-ef2afd0511a1)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
[mschelln@gw:~]$

Also checked with v1.5.2...works as well.
So, it seems to be an issue for v1.6.1 only.

References

no references

OTC renaming missleading resource key's

terraform -v
Terraform v0.11.7
+ provider.opentelekomcloud v1.1.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_elb_loadbalancer
  • opentelekomcloud_rds_instance_v1

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

opentelekomcloud_rds_instance_v1
subnetID is missleading here, since the vpcID is needed
Refer to: #80

 nics {
    subnetid = "b65f8d25-c533-47e2-8601-cfaa265a3e3e"
  }
 nics {
    vpc_id = "${opentelekomcloud_networking_network_v2.vpc.id}"
  }

opentelekomcloud_rds_instance_v1
vpcID is missleading here, since the router_id is needed
Refer to: #81

resource "opentelekomcloud_elb_loadbalancer" "load_balancer" {
  name           = "some-elb"
  region         = "eu-de"
  description    = "changeme"
  type           = "External"
  vpc_id         = "${opentelekomcloud_networking_network_v2.vpc.id}"
  admin_state_up = "true"
  bandwidth      = 5
}
resource "opentelekomcloud_elb_loadbalancer" "load_balancer" {
  name           = "some-elb"
  region         = "eu-de"
  description    = "changeme"
  type           = "External"
  vpc_id         = "${opentelekomcloud_networking_router_v2.router.id}"
  admin_state_up = "true"
  bandwidth      = 5
}

It reports 'ECS-AutoRecovery: Resource not found' when creating vm

Terraform Version

any version

Affected Resource(s)

opentelekomcloud_compute_instance_v2

Terraform Configuration Files

resource "opentelekomcloud_compute_instance_v2" "instance_1" {
name = "instance_1"
security_groups = ["default"]
availability_zone = "u-west-0a"
metadata {
foo = "bar"
}
network {
uuid = "369162a3-e3da-4038-8b54-943d2320d5e8"
}
}

Debug Output

Error reading auto recovery of instance:feefe291-322d-47a8-8d10-d4249d83e021, err=ECS-AutoRecovery: Resource not found

Panic Output

no

Expected Behavior

The instance will be created successfully

Actual Behavior

Create instance failed

Steps to Reproduce

terraform apply

ECS Instance unable to choose DISK-I/O-type of local volume

Hi there,

unfortunatly I'm unable to change the type of my boot volume.
Since block devices cannot be mounted as boot volumes I need to create, attach and mount additional volumes which is very unhandy.

Terraform Version

$ terraform -v
Terraform v0.11.10
+ provider.local v1.1.0
+ provider.null v1.0.0
+ provider.opentelekomcloud v1.3.0
+ provider.random v2.0.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_compute_instance_v2

Terraform Configuration Files

variable "ecs_volume_type" {
    description = "SSD (ultra-high I/O), SAS (high I/O disk), SATA (common I/O disk)"
}

resource "opentelekomcloud_compute_instance_v2" "ecs_instance" {
[...]
  image_name        = "${var.ecs_image_name}"
  flavor_name       = "${var.ecs_flavor}"
[...]

  metadata {
[...]
  }

  block_device {
    uuid                  = "${data.opentelekomcloud_images_image_v2.ecs_image_data.id}"
    volumetype            = "${var.ecs_volume_type}"
    source_type           = "image"
    boot_index            = 0
    destination_type      = "local"
    delete_on_termination = "${var.delete_on_termination}"
  }

  network {
[...]
  }

}

Expected Behavior

To choose wether my boot volume is SSD, SAS or SATA like its written in api doc of OpenTelekomCloud (OTC)
https://docs.otc.t-systems.com/en-us/api/ecs/en-us_topic_0020212668.html

Actual Behavior

Error: module.[...].opentelekomcloud_compute_instance_v2.ecs_instance[0]: block_device.0: invalid or unknown key: volumetype

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan

Support for SFS, RDS (HA)

Hi there,

do you plan to provide terraform support for SFS, RDS (HA), DDS and block device encryption for RDS and DDS?

Thanks,
Robert

[PROPOSAL] Switch to Go Modules

As part of the preparation for Terraform v0.12, we would like to migrate all providers to use Go Modules. We plan to continue checking dependencies into vendor/ to remain compatible with existing tooling/CI for a period of time, however go modules will be used for management. Go Modules is the official solution for the go programming language, we understand some providers might not want this change yet, however we encourage providers to begin looking towards the switch as this is how we will be managing all Go projects in the future. Would maintainers please react with ๐Ÿ‘ for support, or ๐Ÿ‘Ž if you wish to have this provider omitted from the first wave of pull requests. If your provider is in support, we would ask that you avoid merging any pull requests that mutate the dependencies while the Go Modules PR is open (in fact a total codefreeze would be even more helpful), otherwise we will need to close that PR and re-run go mod init. Once merged, dependencies can be added or updated as follows:

$ GO111MODULE=on go get github.com/some/module@master
$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor

GO111MODULE=on might be unnecessary depending on your environment, this example will fetch a module @ master and record it in your project's go.mod and go.sum files. It's a good idea to tidy up afterward and then copy the dependencies into vendor/. To remove dependencies from your project, simply remove all usage from your codebase and run:

$ GO111MODULE=on go mody tidy
$ GO111MODULE=on go mod vendor

Thank you sincerely for all your time, contributions, and cooperation!

Wrong reference vpc_id should be router_id

Terraform Version

$ terraform --version
Terraform v0.11.11
+ provider.opentelekomcloud v1.5.2


Affected Resource(s)

  • opentelekomcloud_cce_cluster_v3

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "opentelekomcloud_cce_cluster_v3" "cce_cluster" {
  name = "${var.project_name}-cce-${var.network_name}"

  description            = "CCE Cluster for: ${var.project_name} in ${var.network_name}"
  flavor_id              = "${var.cce_master_flavor}"
  cluster_version        = "${var.cce_version}"
  container_network_type = "${var.cce_pod_network_type}"
  vpc_id                 = "${var.router_id}"
  subnet_id              = "${var.subnet_id}"
  cluster_type           = "VirtualMachine"
}

opentelekomcloud_networking_network_v2.vpc.id is different from opentelekomcloud_networking_router_v2.router.id and seams to be required.

This might be an issue on OTC side aswell because the output always tells that the VPC <VPCID> not found

Expected Behavior

vpc_id should be referenced correctly.

Actual Behavior

instead OTC requires the router_id

Steps to Reproduce

  1. terraform apply

the resource of elb backend will be re-created again

Terraform Version

any version

Affected Resource(s)

  • opentelekomcloud_elb_backend

Terraform Configuration Files

resource "opentelekomcloud_elb_backend" "backend_1" {
address = "192.168.98.11"
listener_id = "f8ee22146a89487286b91df1cd4cb798"
server_id = "ae2f662a-a825-450d-909e-b8ee3cf507ac"
}

Expected Behavior

no option has been changed after running 'terraform apply'

Actual Behavior

'terraform plan' says the option of 'address' has been changed after running 'terraform apply'

address: "192.168.98.11" => "10.0.0.106" (forces new resource)
listener_id: "f8ee22146a89487286b91df1cd4cb798" => "f8ee22146a89487286b91df1cd4cb798"
server_id: "ae2f662a-a825-450d-909e-b8ee3cf507ac" => "ae2f662a-a825-450d-909e-b8ee3cf507ac"

Steps to Reproduce

run terraform with that config

Lack of documents of ELB service

Now the provider codes for ELB service are there, however the relative documentation cannot be found.

Terraform Version

any versions

Affected Resource(s)

Please list the resources as a list, for example:

  • elb_backend
  • elb_health
  • elb_listener
  • elb_loadbalancer

Expected Behavior

The docs for ELB service can be found

Actual Behavior

None of them there.

References

N/A

Propose to support RDS service of opentelekom CPI

RDS(Relational Database Service)[1] is a service api[2] by which can be able to provisioning/delete Relational DB instances on opentelekom cloud. it is an important service for App that should be managed by terraform to create/delete instances automatically.

This is a proposal to support RDS service in this provider.

Terraform Version

any(not request fix verison)

Affected Resource(s)

This issue propose to add a new resource:

  • rds_instance

Terraform Configuration Files

After this proposal completed, user can provisioning DB instances via following example scripts

data "opentelekomcloud_rds_flavors_v1" "flavor" {
  region = "eu-de"
  datastore_name = "PostgreSQL"
  datastore_version = "9.5.5"
}

resource "opentelekomcloud_rds_instance_v1" "instance" {
  name = "${var.project}-instance"
  datastore {
    type = "PostgreSQL"
    version = "9.5.5"
  }
  flavorref = "${data.opentelekomcloud_rds_flavors_v1.flavor.id}"
  volume {
    type = "COMMON"
    size = 100
  }
  region = "eu-de"
  availabilityzone = "eu-de-01"
  vpc = "${opentelekomcloud_networking_router_v2.router.id}"
  nics {
    subnetid = "${opentelekomcloud_networking_network_v2.network.id}"
  }
  securitygroup {
    id = "${opentelekomcloud_compute_secgroup_v2.secgrp_web.id}"
  }
  dbport = "8635"
  backupstrategy = {
    starttime = "00:00:00"
    keepdays = 0
  }
  dbrtpd = "Huangwei!120521"
}

Expected Behavior

RDS DB instance can be managed by terraform

Actual Behavior

RDS doesn't support by this provider yet

Important Factoids

This proposal is to add the following resources:

  1. a datasource of rds flavor named data_source_opentelekomcloud_rds_flavors_v1
  2. a resource of rds instance named resource_opentelekomcloud_rds_instance_v1
  3. a doc to explain the parameter as other resources did.

As this service is not one service of openstack, however this provider use gophercloud (a SDK of openstack) as the access of services now. to support this proposal, I am trying to add a new SDK[3] which is a supper sets of gophercloud maintained by opentelekom cloud team.

References

[1]https://docs.otc.t-systems.com/en-us/rds_dld/index.html
[2]https://docs.otc.t-systems.com/en-us/api/rds/en-us_topic_0032347780.html
[3]https://github.com/huaweicloud/golangsdk

availability_zone seems to be required now

Hi there,
the last couple days we had trouble creating new opentelekomcloud_compute_instance_v2 resources. After some research and debugging we found the issue: the missing availability_zone-parameter. Regarding the docs this parameter should be optional and is computed. But without this parameter the resource is not created and fails with this error:
retry 2 times: Could not find a handler for proxy volume.;Could not find a handler for proxy volume...No valid host was found. There are not enough hosts available
(sadly this error message is not recognized by terraform, it was extracted with a networktraffic dump)
If the availability_zone is set in the resource, everything runs fine.
Has anyone else ran into this issue?

Terraform Version

Terraform v0.11.10
+ provider.null v1.0.0
+ provider.opentelekomcloud v1.3.0
+ provider.template v1.0.0

Affected Resource(s)

  • opentelekomcloud_compute_instance_v2

Terraform Configuration Files

(abstracted from original code)

Fails with error:

resource "opentelekomcloud_compute_instance_v2" "instance_test" {
  count           = 1
  name            = "instance-test"
  image_name      = "Community_Ubuntu_16.04_TSI_latest"
  flavor_name     = "s2.medium.1"
  key_pair        = "deploy-key"

  security_groups = [
    "default"
  ]

  network {
    name = "my_network"
  }
}

No Problems:

resource "opentelekomcloud_compute_instance_v2" "instance_test" {
  count           = 1
  name            = "instance-test"
  image_name      = "Community_Ubuntu_16.04_TSI_latest"
  flavor_name     = "s2.medium.1"
  key_pair        = "deploy-key"
  availability_zone = "eu-de-02"

  security_groups = [
    "default"
  ]

  network {
    name = "my_network"
  }
}

Only availability_zone is added.

Expected Behavior

Regarding docs it should run without an given availability_zone.

Actual Behavior

Creation is aborted.

Steps to Reproduce

  1. terraform apply

Incorrect documentation for DNS zone

The DNS zone actually support to configuration private/public zone, but the doc still show example for PRIMARY and SECONDARY. please refer documentation and code for more information

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_dns_zone_v2

CCE Cluster + Nodes failed to provision duo to 504 by OTC

Terraform Version

$ terraform --version
Terraform v0.11.11
+ provider.opentelekomcloud v1.5.2

Affected Resource(s)

  • opentelekomcloud_cce_cluster_v3
  • opentelekomcloud_cce_node_v3

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "opentelekomcloud_cce_cluster_v3" "cce_cluster" {
  name = "${var.project_name}-cce-${var.network_name}"

  description            = "CCE Cluster for: ${var.project_name} in ${var.network_name}"
  flavor_id              = "${var.cce_master_flavor}"
  cluster_version        = "${var.cce_version}"
  container_network_type = "${var.cce_pod_network_type}"
  vpc_id                 = "${var.vpc_id}"
  subnet_id              = "${var.subnet_id}"
  cluster_type           = "VirtualMachine"
}

resource "opentelekomcloud_cce_node_v3" "cce_node" {
  count      = "${var.cce_nodes}"
  cluster_id = "${opentelekomcloud_cce_cluster_v3.cce_cluster.id}"

  flavor_id = "${var.cce_node_flavor}"
  key_pair  = "${var.key_pair_name}"

  iptype         = "5_bgp"
  bandwidth_size = "1"
  sharetype      = "PER"

  availability_zone = "${element(var.availability_zones, count.index+1)}"

  # TODO: EIP assignment does not work ATM
  # eip_ids           = ["${opentelekomcloud_networking_floatingip_v2.cce_floating_ip.*.address}"]

  root_volume {
    size       = "${var.cce_node_root_volume_size}"
    volumetype = "${var.cce_node_volume_type}"
  }
  data_volumes {
    size       = "${var.cce_node_data_volume_size}"
    volumetype = "${var.cce_node_volume_type}"
  }
}

Debug Output

https://gist.github.com/Moep90/794c69fd47cf5ac6ea49308969ff39bc

Expected Behavior

The CCE-Cluster should provisioned correctly with specified node count.
Also CCE should GET the Node-Count of a CCE before creating additionals.
Since I lately had 10 nodes instead of two which I specified.

Actual Behavior

CCE-Cluster gets created, then it starts to provision the nodes but then gets a 504 "Wait for response".
Which returns an error within this provider as follows:

POST https://cce.eu-de.otc.t-systems.com/api/v3/projects/<otc-projectID>/clusters], but got 504 instead
{"message":"Wait response timeout.","request_id":"9cbf313732228bf0ab0472e3b07a2587"}
2019/01/30 14:47:50 [ERROR] root.cce_<zone1>: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

The Request Body for CCE looks fine to me. When refering to the API-Doc
https://docs.otc.t-systems.com/en-us/api2/cce/cce_02_0236.html

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

opentelekomcloud_rds_instance_v1 issue's

Terraform Version

terraform --version
Terraform v0.11.7
+ provider.openstack v1.5.0
+ provider.opentelekomcloud v1.1.0

Affected Resource(s)

opentelekomcloud_rds_instance_v1

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

data "opentelekomcloud_rds_flavors_v1" "rds_flavor" {
    region            = "${var.region}"
    datastore_name    = "MySQL"
    datastore_version = "${var.rds_datastore_version}"
    speccode          = "rds.mysql.s1.medium"
}

resource "opentelekomcloud_rds_instance_v1" "instance" {
  name              = "${var.project}-${terraform.workspace}-rds-instance"
  region            = "${var.region}"
  vpc               = "${openstack_networking_network_v2.vpc.id}"
  availabilityzone  = "${var.availability_zones[0]}"

  dbport            = "${var.rds_db_port}"
  dbrtpd            = "${var.rds_db_root_user_pw}"

  backupstrategy = {
    starttime       = "04:00:00"
    keepdays        = "${var.rds_backup_keepdays}"
  }

  ha = {
    enable          = true
    replicationmode = "async"
  }

  datastore {
    type            = "MySQL"
    version         = "${var.rds_datastore_version}"
  }
  flavorref         = "${data.opentelekomcloud_rds_flavors_v1.rds_flavor.id}"

  volume {
    type            = "COMMON"
    size            = "${var.rds_db_size}"
  }
  nics {
    subnetid        = "${openstack_networking_subnet_v2.subnet.id}"
  }

  securitygroup {
    id              = "${openstack_networking_secgroup_v2.inside_rds_traffic.id}"
  }
}

Debug Output

https://gist.github.com/Moep90/cc7caba8217aff6b84bf26ba53f9c1e1

Expected Behavior

The RDS instance should use the correct referenced RDS-flavor
https://www.terraform.io/docs/providers/opentelekomcloud/r/rds_instance_v1.html

Actual Behavior

It crashes because the data fetch will not find an exected flavor

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

[Feature Request] Add Identity service support

The User, Role, Project are important resource in cloud, since this provider does not support such resources yet, this issue proposes to add identity service support.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Affected Resource(s)

resources:

  • opentelekomcloud_identity_user
  • opentelekomcloud_identity_group
  • opentelekomcloud_identity_role
  • opentelekomcloud_identity_project

datasources:

  • opentelekomcloud_identity_user
  • opentelekomcloud_identity_group
  • opentelekomcloud_identity_role
  • opentelekomcloud_identity_project

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Steps to Reproduce

it is new feature

Important Factoids

N/A

References

https://docs.otc.t-systems.com/en-us/api/iam/iam_02_0017.html

opentelekomcloud_elb_loadbalancer - ELB.1009: CreateIPTask-fail

Terraform Version

terraform --version
Terraform v0.11.7
+ provider.opentelekomcloud v1.1.0

Affected Resource(s)

opentelekomcloud_elb_loadbalancer

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

### network
resource "opentelekomcloud_networking_network_v2" "vpc" {
  name           = "${var.project}-${terraform.workspace}-vpc"
  admin_state_up = "true"
}

resource "opentelekomcloud_networking_subnet_v2" "subnet" {
  name            = "${var.project}-${terraform.workspace}-subnet"
  network_id      = "${opentelekomcloud_networking_network_v2.vpc.id}"
  cidr            = "${var.cidr_subnets[0]}"
  dns_nameservers = ["${var.nameserver}"]
  ip_version      = 4
}

resource "opentelekomcloud_elb_loadbalancer" "load_balancer" {
  name           = "${var.project}-${terraform.workspace}-elb"
  region         = "${var.region}"
  description    = "ELB Projekt: ${var.project} Stage: ${terraform.workspace}"
  type           = "External"
  vpc_id         = "${opentelekomcloud_networking_network_v2.vpc.id}"
  admin_state_up = "true"
  bandwidth      = 5
}

The statefile:

                "opentelekomcloud_networking_network_v2.vpc": {
                    "type": "opentelekomcloud_networking_network_v2",
                    "depends_on": [],
                    "primary": {
                        "id": "5b5128e5-f6e9-4d39-981c-6885cccd0171",
                        "attributes": {
                            "admin_state_up": "true",
                            "id": "5b5128e5-f6e9-4d39-981c-6885cccd0171",
                            "name": "<project-name>-<prod>-vpc",
                            "region": "eu-de",
                            "shared": "false",
                            "tenant_id": "fb40b1705b9b4796a7a2abd379cf2dc3"
                        },
                        "meta": {
                            "e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": {
                                "create": 600000000000,
                                "delete": 600000000000
                            }
                        },
                        "tainted": false
                    },
                    "deposed": [],
                    "provider": "provider.opentelekomcloud"
                },

Debug Output

https://gist.github.com/Moep90/7f2b3abe2b3a85c79ad9cdc472e56aa6

Expected Behavior

Provision the ELB or tell which error is in my configuration file

Actual Behavior

Crash with: "Job failed with code ELB.1009: CreateIPTask-fail"

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

instances with multiple NIC - 2nd NIC not configured

Hi there,

I need to create instances with two NICs - one with public IP and another for VM-VM communications, with static IP assigned. I've created one router, two subnets, two network blocks in instance definition,

Terraform v0.11.3
+ provider.opentelekomcloud (unversioned)
+ provider.template v1.0.0

Affected Resource(s)

  • opentelekomcloud_compute_instance_v2

Terraform Configuration Files

resource "opentelekomcloud_compute_instance_v2" "test_instance" {
  count           = "1"
  name            = "${var.dnsname}"
  image_name      = "Community_Ubuntu_16.04_TSI_latest"
  flavor_name     = "${var.flavor_name}"
  key_pair        = "${opentelekomcloud_compute_keypair_v2.keypair.name}"
  region      = "${var.region}"
  stop_before_destroy = true
  security_groups = [
    "${opentelekomcloud_compute_secgroup_v2.secgrp_web.name}"
  ]
  user_data = "${data.template_cloudinit_config.cloud-init-data.rendered}"

  network {
    uuid           = "${opentelekomcloud_networking_network_v2.test_network.id}"
  }
  network {
    uuid           = "${opentelekomcloud_networking_network_v2.test_network_internal.id}"
    fixed_ip_v4 = "10.0.1.11"
  }
}

Expected Behavior

Instance created, static IP assigned to second NIC

Actual Behavior

Instance created, second NIC is down/not configured

state at instance

$ ip a show dev ens3
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether fa:16:3e:8b:bb:0b brd ff:ff:ff:ff:ff:ff
    inet 192.168.15.50/24 brd 192.168.15.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fe8b:bb0b/64 scope link
       valid_lft forever preferred_lft forever

$ ip a show dev ens4
3: ens4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether fa:16:3e:ac:f8:20 brd ff:ff:ff:ff:ff:ff

$ cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback

auto ens3
iface ens3 inet dhcp

state at host

$ terraform show 
  ...
  network.# = 2
  network.0.access_network = false
  network.0.fixed_ip_v4 = 192.168.15.74
  network.0.fixed_ip_v6 =
  network.0.floating_ip =
  network.0.mac = fa:16:3e:44:66:53
  network.0.name = test-network
  network.0.port =
  network.0.uuid = 79ea8641-b9ed-4bb4-b453-8dcbe698982d
  network.1.access_network = false
  network.1.fixed_ip_v4 = 10.0.1.11
  network.1.fixed_ip_v6 =
  network.1.floating_ip =
  network.1.mac = fa:16:3e:94:3e:4d
  network.1.name = test-network-internal
  network.1.port =
  network.1.uuid = 409e0a5b-3b01-4cdb-ae8b-0c11c6c34e01
...

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Assigning firewalls

Terraform Version

Terraform v0.11.11

  • provider.openstack v1.14.0
  • provider.opentelekomcloud v1.5.2

Affected Resource(s)

  • opentelekomcloud_fw_firewall_group

Terraform Configuration Files

resource "opentelekomcloud_fw_firewall_group_v2" "public" {
  name = "public"
  ingress_policy_id = "${opentelekomcloud_fw_policy_v2.public_in.id}"
  egress_policy_id = "${opentelekomcloud_fw_policy_v2.public_out.id}"
}

Expected Behavior

I can assign a firewall using Terraform.

Actual Behavior

OTC creates custom routers when you create a VPC. There's no automatic way to get those "side-effect" resources. One of them would be a port whose ID I need to assign the firewall. Without it, the firewall configuration is pointless. How do I assign a firewall? Enabling SNAT for the automatically created router is another such example.

Add EIP resource support

Currently we only have FIP support as OpenStack provider, but Opentelekom cloud also provides a more powerful EIP resource management which includes bandwidth customization and more other flexible options. So this requests to add that support.

RDS HA-Setup: Resource will renamed on every rerun by terraform

terraform -v
Terraform v0.11.7
+ provider.opentelekomcloud v1.1.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_rds_instance_v1

Terraform Configuration Files

data "opentelekomcloud_rds_flavors_v1" "rds_flavor" {
    region            = "${var.region}"
    datastore_name    = "MySQL"
    datastore_version = "${var.rds_datastore_version}"
    speccode          = "rds.mysql.s1.medium.ha"
}

resource "opentelekomcloud_rds_instance_v1" "instance" {
  name              = "${var.project}-${terraform.workspace}-rds-instance"
  region            = "${var.region}"
  vpc               = "${opentelekomcloud_networking_router_v2.router.id}"
  availabilityzone  = "${var.availability_zones[0]}"

  dbport            = "${var.rds_db_port}"
  dbrtpd            = "${var.rds_db_root_user_pw}"

  backupstrategy = {
    starttime       = "04:00:00"
    keepdays        = "${var.rds_backup_keepdays}"
  }

  ha = {
    enable          = true
    replicationmode = "async"
  }

  datastore {
    type            = "MySQL"
    version         = "${var.rds_datastore_version}"
  }
  flavorref         = "${data.opentelekomcloud_rds_flavors_v1.rds_flavor.id}"

  volume {
    type            = "COMMON"
    size            = "${var.rds_db_size}"
  }
  nics {
    subnetid        = "${opentelekomcloud_networking_network_v2.vpc.id}"
  }

  securitygroup {
    id              = "${opentelekomcloud_networking_secgroup_v2.inside_rds_traffic.id}"
  }
}

Debug Output

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ opentelekomcloud_rds_instance_v1.instance
      name: "terraform-testing-rds-instance_node0" => "terraform-testing-rds-instance"


Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

opentelekomcloud_rds_instance_v1.instance: Modifying... (ID: 4ddaffc75a1a440581ca07467a31e2ebno01)
  name: "terraform-testing-rds-instance_node0" => "terraform-testing-rds-instance"
opentelekomcloud_rds_instance_v1.instance: Modifications complete after 0s (ID: 4ddaffc75a1a440581ca07467a31e2ebno01)

Panic Output

Expected Behavior

Terraform should not find any update.

Actual Behavior

If I rerun terraform apply it always try to rename the resource.
I thin that OTC is adding a _node0 because the HA-Setup

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. terraform apply

Error while creating instance

Hi there,

Terraform Version

terraform version
Terraform v0.11.3
+ provider.opentelekomcloud v1.0.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_compute_instance_v2

Terraform Configuration Files

provider "opentelekomcloud" {
  user_name   = "username"
  tenant_name = "eu-de"
  domain_name = "OTC-EU-DE-000000000010000XXXXX"
  password    = "password"
  auth_url    = "https://iam.eu-de.otc.t-systems.com/v3"
  region      = "eu-de"
}

# Create a web server
resource "opentelekomcloud_compute_instance_v2" "test-server" {
  name          = "test-server"
  image_name  = "Standard_CentOS_7_latest"
  flavor_name = "s1.medium"
}

Debug Output

opentelekomcloud_compute_instance_v2.test-server: Still creating... (50s elapsed)
2018/03/04 13:54:44 [TRACE] dag/walk: vertex "meta.count-boundary (count boundary fixup)", waiting for: "opentelekomcloud_compute_instance_v2.test-server"
2018/03/04 13:54:44 [TRACE] dag/walk: vertex "provider.opentelekomcloud (close)", waiting for: "opentelekomcloud_compute_instance_v2.test-server"
2018/03/04 13:54:44 [TRACE] dag/walk: vertex "root", waiting for: "provider.opentelekomcloud (close)"
2018/03/04 13:54:49 [TRACE] dag/walk: vertex "meta.count-boundary (count boundary fixup)", waiting for: "opentelekomcloud_compute_instance_v2.test-server"
2018/03/04 13:54:49 [TRACE] dag/walk: vertex "provider.opentelekomcloud (close)", waiting for: "opentelekomcloud_compute_instance_v2.test-server"
2018/03/04 13:54:49 [TRACE] dag/walk: vertex "root", waiting for: "provider.opentelekomcloud (close)"
opentelekomcloud_compute_instance_v2.test-server: Still creating... (1m0s elapsed)
2018-03-04T13:54:52.023+0200 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.0.0_x4: 2018/03/04 13:54:52 [DEBUG] getAllInstanceNetworks: []opentelekomcloud.InstanceNetwork(nil)
2018-03-04T13:54:52.023+0200 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.0.0_x4: 2018/03/04 13:54:52 [DEBUG] Create Options: &servers.CreateOpts{Name:"test-server", ImageRef:"ac0645c5-43be-488f-9ac8-b7fd5c372d24", ImageName:"", FlavorRef:"normal1", FlavorName:"", SecurityGroups:[]string{}, UserData:[]uint8{}, AvailabilityZone:"", Networks:[]servers.Network(nil), Metadata:map[string]string{}, Personality:servers.Personality(nil), ConfigDrive:(*bool)(0xc420139bd9), AdminPass:"", AccessIPv4:"", AccessIPv6:"", ServiceClient:(*gophercloud.ServiceClient)(nil)}
2018/03/04 13:54:52 [TRACE] root: eval: *terraform.EvalWriteState
2018/03/04 13:54:52 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2018/03/04 13:54:52 [TRACE] root: eval: *terraform.EvalIf
2018/03/04 13:54:52 [TRACE] root: eval: *terraform.EvalWriteState
2018/03/04 13:54:52 [TRACE] root: eval: *terraform.EvalWriteDiff
2018/03/04 13:54:52 [TRACE] root: eval: *terraform.EvalApplyPost
2018/03/04 13:54:52 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* opentelekomcloud_compute_instance_v2.test-server: Error creating OpenTelekomCloud server: Invalid request due to incorrect syntax or missing required parameters.
2018/03/04 13:54:52 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

Expected Behavior

instance created

Actual Behavior

error reported

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Shared SNAT enable on creation

Hi there,

I'm creating VPC with mix of instances with floating IP and without floating IP.

After creation, instances which don't have floating IP, can't access Internet by default, unless Shared SNAT is enabled manually in OTC GUI console.

Terraform Version

Terraform v0.11.3

  • provider.null v1.0.0
  • provider.opentelekomcloud (unversioned)

Affected Resource(s)

opentelekomcloud_networking_router_v2

Terraform Configuration Files

resource "opentelekomcloud_networking_router_v2" "k8s" {
  name                = "${var.cluster_name}-router"
  admin_state_up      = "true"
  external_gateway = "${var.external_net}"
}

Expected Behavior

Instances with floating IP can access Internet
Instances without floating IP can access Internet

Actual Behavior

Instances with floating IP can access Internet
Instances without floating IP cannot access Internet

Steps to Reproduce

Create router, interface, assign subnet,
create instances with and without floating IP in the same subnet.

Important Factoids

default security group allows all outbound traffic

[Request] Adding EIP to Enhanced Load Balancer

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_lb_loadbalancer_v2
  • opentelekomcloud_lb_floatingip_associate_v2

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

ELB Resource

resource "opentelekomcloud_lb_loadbalancer_v2" "elbv2" {
  name           = "${var.project_name}-external-elb"
  description    = "${var.elb_description}"
  vip_subnet_id  = "${var.elb_subnet_id}"
  admin_state_up = "${var.elb_admin_state}"
  vip_address    = "${opentelekomcloud_networking_floatingip_v2.floatingip.address}"
}

Obtaining EIP

resource "opentelekomcloud_networking_floatingip_v2" "floatingip" {
  pool = "${data.opentelekomcloud_networking_network_v2.extnet.name}"
}

Assign it to the ELB

resource "opentelekomcloud_compute_floatingip_associate_v2" "floatingip_associate" {
  floating_ip = "${opentelekomcloud_networking_floatingip_v2.floatingip.address}"
  instance_id = "${opentelekomcloud_lb_loadbalancer_v2.elbv2.id}"
  fixed_ip    = "${opentelekomcloud_lb_loadbalancer_v2.elbv2.vip_address}"
}

This results non surprising in:

2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: 2018/11/21 17:44:45 [DEBUG] OpenTelekomCloud Region is: eu-de
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: 2018/11/21 17:44:45 [DEBUG] Associate Options: floatingips.AssociateOpts{FloatingIP:"<external ip>", FixedIP:"<internal IP>"}
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: 2018/11/21 17:44:45 [DEBUG] OpenTelekomCloud Request URL: POST https://ecs.eu-de.otc.t-systems.com/v2/<some ID>/servers/<some other ID>/action
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: 2018/11/21 17:44:45 [DEBUG] OpenTelekomCloud Request Headers:
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: Accept: application/json
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: Content-Type: application/json
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: User-Agent: Terraform 0.10.0-dev (go1.10.3) gophercloud/2.0.0
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: X-Auth-Token: ***
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4: 2018/11/21 17:44:45 [DEBUG] OpenTelekomCloud Request Body: {
2018-11-21T17:44:45.382+0100 [DEBUG] plugin.terraform-provider-opentelekomcloud_v1.3.0_x4:   "addFloatingIp": {
[...]

Accodring to the docs there is another endpoint for elb's
https://docs.otc.t-systems.com/en-us/api/elb/en-us_topic_0096561536.html

Using the openstack_networking_floatingip_associate_v2 solves it for me...

resource "openstack_networking_floatingip_associate_v2" "floatingip_associate" {
  floating_ip = "${opentelekomcloud_networking_floatingip_v2.floatingip.address}"
  port_id = "${opentelekomcloud_lb_loadbalancer_v2.elbv2.vip_port_id}"
}

Expected Behavior

To have the ability to use the Enhanced Load Balancer and assign it a EIP as in the UI.

Actual Behavior

There is no resource to do so.
It may work as a copy of opentelekomcloud_compute_floatingip_associate_v2 with another endpoint.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Broken links / layout in markdown

The terraform.io website build encountered a couple errors on the website for this provider:

...
[22:20:51][docker] Found 4 broken links.
[22:20:51][docker] 
[22:20:51][docker] https://www.terraform.io/docs/providers/opentelekomcloud/d/lb_backend.html
[22:20:51][docker] https://www.terraform.io/docs/providers/opentelekomcloud/r/kms_key_v1.html
[22:20:51][docker] https://www.terraform.io/docs/providers/opentelekomcloud/d/kms_key_v1.html
[22:20:51][docker] https://www.terraform.io/docs/providers/opentelekomcloud/d/kms_data_key_v1.html
...
[22:12:31][docker] == Request: /docs/providers/opentelekomcloud/d/kms_data_key_v1.html
[22:12:31][docker] == Finishing Request: docs/providers/opentelekomcloud/d/kms_data_key_v1.html (0.0s)
[22:12:31][docker]        error  build/docs/providers/opentelekomcloud/d/kms_data_key_v1.html
[22:12:31][docker] Error: Could not locate layout: huaweicloud
[22:12:31][docker] == Request: /docs/providers/opentelekomcloud/d/rds_flavors_v1.html
[22:12:31][docker] == Finishing Request: docs/providers/opentelekomcloud/d/rds_flavors_v1.html (0.01s)
[22:12:31][docker]       create  build/docs/providers/opentelekomcloud/d/rds_flavors_v1.html
[22:12:31][docker] == Request: /docs/providers/opentelekomcloud/d/kms_key_v1.html
[22:12:31][docker] == Finishing Request: docs/providers/opentelekomcloud/d/kms_key_v1.html (0.0s)
[22:12:31][docker]        error  build/docs/providers/opentelekomcloud/d/kms_key_v1.html
[22:12:31][docker] Error: Could not locate layout: huaweicloud
[22:12:31][docker] == Request: /docs/providers/opentelekomcloud/d/elb_backend.html
[22:12:31][docker] == Finishing Request: docs/providers/opentelekomcloud/d/elb_backend.html (0.01s)
[22:12:31][docker]       create  build/docs/providers/opentelekomcloud/d/elb_backend.html
...
[22:12:31][docker]       create  build/docs/providers/opentelekomcloud/r/images_image_v2.html
[22:12:31][docker] == Request: /docs/providers/opentelekomcloud/r/kms_key_v1.html
[22:12:31][docker] == Finishing Request: docs/providers/opentelekomcloud/r/kms_key_v1.html (0.0s)
[22:12:31][docker]        error  build/docs/providers/opentelekomcloud/r/kms_key_v1.html
[22:12:31][docker] Error: Could not locate layout: huaweicloud
[22:12:31][docker] == Request: /docs/providers/opentelekomcloud/r/lb_pool_v2.html
[22:12:31][docker] == Finishing Request: docs/providers/opentelekomcloud/r/lb_pool_v2.html (0.01s)
...

Please take a look!

These checks should now be part of the Travis CI run, so hopefully they will be caught in the PR's going forward.

Terraform will recreate compute instance on second run.

Terraform Version

$ terraform -v
Terraform v0.11.10

Affected Resource(s)

  • opentelekomcloud_compute_instance_v2

Terraform Configuration Files

resource "opentelekomcloud_compute_instance_v2" "swarm" {
  name        = "swarm"
  flavor_name = "s2.xlarge.4"

  block_device {
    uuid                  = "<image-id>"
    source_type           = "image"
    volume_size           = "75"
    boot_index            = 0
    destination_type      = "volume"
    delete_on_termination = true
  }

  security_groups = ["${opentelekomcloud_compute_secgroup_v2.allow_admin.name}"]

  key_pair = "${opentelekomcloud_compute_keypair_v2.keypair.name}"

  network {
    uuid = "${opentelekomcloud_networking_network_v2.network.id}"
  }

  depends_on = ["opentelekomcloud_networking_router_interface_v2.swarm-interface"]
}

resource "opentelekomcloud_compute_secgroup_v2" "allow_admin" {
  name        = "allow_admin"
  description = "Allow Access from Admin Network"

  rule {
    from_port   = 1
    to_port     = 65535
    ip_protocol = "tcp"
    cidr        = "10.10.20.0/24"
  }
}

After First Apply

  + opentelekomcloud_compute_instance_v2.swarm
      id:                                   <computed>
      access_ip_v4:                         <computed>
      access_ip_v6:                         <computed>
      all_metadata.%:                       <computed>
      availability_zone:                    <computed>
      block_device.#:                       "1"
      block_device.0.boot_index:            "0"
      block_device.0.delete_on_termination: "true"
      block_device.0.destination_type:      "volume"
      block_device.0.source_type:           "image"
      block_device.0.uuid:                  "<image-id>"
      block_device.0.volume_size:           "75"
      flavor_id:                            <computed>
      flavor_name:                          "s2.xlarge.4"
      force_delete:                         "false"
      image_id:                             <computed>
      image_name:                           <computed>
      key_pair:                             "admin_key"
      name:                                 "swarm"
      network.#:                            "1"
      network.0.access_network:             "false"
      network.0.fixed_ip_v4:                <computed>
      network.0.fixed_ip_v6:                <computed>
      network.0.floating_ip:                <computed>
      network.0.mac:                        <computed>
      network.0.name:                       <computed>
      network.0.port:                       <computed>
      network.0.uuid:                       "_hidden_"
      power_state:                          "active"
      region:                               <computed>
      security_groups.#:                    "1"
      security_groups.939519410:            "allow_admin"
      stop_before_destroy:                  "false"

On Second Apply (No Changes on Config)

-/+ opentelekomcloud_compute_instance_v2.swarm (new resource required)
      id:                                   "_hidden_" => <computed> (forces new resource)
      access_ip_v4:                         "10.10.10.235" => <computed>
      access_ip_v6:                         "" => <computed>
      all_metadata.%:                       "0" => <computed>
      availability_zone:                    "eu-de-02" => <computed>
      block_device.#:                       "1" => "1"
      block_device.0.boot_index:            "0" => "0"
      block_device.0.delete_on_termination: "true" => "true"
      block_device.0.destination_type:      "volume" => "volume"
      block_device.0.source_type:           "image" => "image"
      block_device.0.uuid:                  "<image-id>" => "<image-id>"
      block_device.0.volume_size:           "75" => "75"
      flavor_id:                            "s2.xlarge.4" => <computed>
      flavor_name:                          "s2.xlarge.4" => "s2.xlarge.4"
      force_delete:                         "false" => "false"
      image_id:                             "Attempt to boot from volume - no image supplied" => <computed>
      image_name:                           "Standard_Ubuntu_18.04_20180816_00" => <computed>
      key_pair:                             "admin_key" => "admin_key"
      name:                                 "swarm" => "swarm"
      network.#:                            "1" => "1"
      network.0.access_network:             "false" => "false"
      network.0.fixed_ip_v4:                "10.10.10.235" => <computed>
      network.0.fixed_ip_v6:                "" => <computed>
      network.0.floating_ip:                "" => <computed>
      network.0.mac:                        "_hidden_" => <computed>
      network.0.name:                       "network" => <computed>
      network.0.port:                       "" => <computed>
      network.0.uuid:                       "_hidden_" => "_hidden_"
      power_state:                          "active" => "active"
      region:                               "" => <computed>
      security_groups.#:                    "0" => "1" (forces new resource)
      security_groups.939519410:            "" => "allow_admin" (forces new resource)
      stop_before_destroy:                  "false" => "false"

Expected Behavior

Terraform don't want to change the Instance Configuration.

Actual Behavior

Terraform will recreate the compute instance because terraform don't find the secgroup on the compute instance.

Steps to Reproduce

  1. terraform apply
  2. terraform apply

On the first terraform apply Terraform is running successful.

terraform crashes at plan (not apply) with the opentelekomified openstack module

This issue was originally opened by @deknos as hashicorp/terraform#18590. It was migrated here as a result of the provider split. The original body of the issue is below.


$ terraform -v
Terraform v0.11.7
+ provider.openstack v1.7.0

Terraform Configuration Files

my configuration files are in http://gbks.net/tf.zip (about 20kb size) without credentials of course :>
i use the opentelekom cloud plugin. i am not entirely sure if this is the right bugtracker or if i should go to opentelekomcloud plugin..

Debug Output

after terraform init ; the call for terraform apply fails, the tracelogs for it are in http://gbks.net/tracelogs.zip

Crash Output

crash.log is in the aforementioned http://gbks.net/tf.zip

Expected Behavior

i know that the configuration works. i did it at one time.

Actual Behavior

crash

Steps to Reproduce

  1. use my config and have correct credentials for OTC
  2. terraform init
  3. terraform apply
  4. crash comes.

Additional Context

I use the opentelekomcloud

ECS - Add support for key-value Tags

Hi all,

as of now the provider does not support 2D / key-value tags.

I have taken a look at the providers source code to figure out, which changes would be required.

The file resource_opentelekomcloud_instance_v2.go makes the call, and input validation would have to be changed to somethin like this:

"tags": &schema.Schema{
  Type:     schema.TypeSet,
  Optional: true,
  Elem:     &schema.Resource{
    Schema: map[string]*schema.Schema{
      "key": &schema.Schema{
        Type:     schema.TypeString,
        Required: true,
      },
      "value": &schema.Schema{
        Type:     schema.TypeString,
        Required: true,
      },
    },
  },
},

Unfortunately, to support 2D tags github.com/huaweicloud/golangsdk/openstack/compute/v2/extensions/tags needs to be changed too - and I am unsure about backwards-compatibility.

This would be the part to change in order to represent the new format:

// CreateOpts implements CreateOptsBuilder
type CreateOpts struct {
	// Tags is a set of tags.
	Tags []string `json:"tags" required:"true"`
}

Probably to something like this:

type CreateOpts struct {
  Tags []struct {
    Key   int    `json:"key"`
    Value string `json:"value"`
  } `json:"tags"`
}

But that would break compatibility and I don't know if anything else relies on this.

Adding/Removing Secgroup+rule forces new resource

Terraform Version

$ terraform -v
Terraform v0.11.7

Affected Resource(s)

  • opentelekomcloud_compute_instance_v2
  • opentelekomcloud_networking_secgroup_rule_v2
  • opentelekomcloud_networking_secgroup_rule_v2

Expected Behavior

Adding or removing a Secgroup, Secrule and applying them without replacing instance

Actual Behavior

Terraform wants to create a new resource.. With new block-device etc etc...

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Instance defenition

resource "opentelekomcloud_compute_instance_v2" "<project>_instances_az0" {
  count             = "${var.<project>_instances_az0_count}"
  name              = "${var.project}-${terraform.workspace}-${var.availability_zones[0]}-node${format("%02d", count.index+1)}"
  image_name        = "${var.image}"
  flavor_name       = "${var.flavor_name}"
  key_pair          = "${opentelekomcloud_compute_keypair_v2.keypair.name}"
  security_groups   = ["${var.project}-${terraform.workspace}-<secgroup3>",
                       "${var.project}-${terraform.workspace}-<secgroup4>"]
  region            = "${var.region}"
  availability_zone = "${var.availability_zones[0]}"

  metadata {
    this = "Projekt: ${var.project} Stage: ${terraform.workspace}"
  }

  block_device {
    uuid              = "${data.opentelekomcloud_images_image_v2.<osname>.id}"
    source_type           = "image"
    volume_size           = "${var.<project>_systemdisk_size}"
    boot_index            = 0
    destination_type      = "volume"
    delete_on_termination = false
  }

  network {
    uuid        = "${opentelekomcloud_networking_network_v2.vpc.id}"
    fixed_ip_v4 = "${var.<project>_instance_priv_ips_az0}${count.index + 1}"
  }
}

Output from plan

-/+ opentelekomcloud_compute_instance_v2.<project-name>_instances_az0[1] (new resource required)
      id:                                   "388<id>27d" => <computed> (forces new resource)
[...]
      availability_zone:                    "eu-de-01" => "eu-de-01"
      block_device.#:                       "1" => "1"
      block_device.0.boot_index:            "0" => "0"
      block_device.0.delete_on_termination: "false" => "false"
      block_device.0.destination_type:      "volume" => "volume"
      block_device.0.source_type:           "image" => "image"
      block_device.0.uuid:                  "9c1<id>278" => "386<id>e12" (forces new resource)
[...]
      security_groups.#:                    "3" => "2" (forces new resource)
      security_groups.<id>:            "" => "<project-name>-<stage>-<secgroupname1>" (forces new resource)
      security_groups.<id>:           "<project-name>-<stage>-<secgroupname2>" => "" (forces new resource)
      security_groups.<id>:           "<project-name>-<stage>-<secgroupname3>" => "<project-name>-<stage>-<secgroupname3>"
      security_groups.<id>:           "<project-name>-<stage>-<secgroupname4>" => "" (forces new resource)
      stop_before_destroy:                  "false" => "false"

Terraform wants to re-sort DNS entries and fails

Terraform Version

Terraform v0.11.7

  • provider.opentelekomcloud v1.1.0

Affected Resource(s)

opentelekomcloud_dns_recordset_v2

Terraform Configuration Files

resource "opentelekomcloud_dns_recordset_v2" "swarm" {
  zone_id = "${opentelekomcloud_dns_zone_v2.infrastructure.id}"
  name    = "swarm.${opentelekomcloud_dns_zone_v2.infrastructure.name}"
  ttl     = 300
  type    = "A"
  records = ["${module.swarm.floating_ipv4}"]

  lifecycle {
    ignore_changes = ["id", "region"]
  }
}

Expected Behavior

DNS entries of module.swarm.floating_ipv4 should not be altered, if no IP changes.

Actual Behavior

DNS entries would get resorted at run, run fails.

      records.0:  "x.x.x.x" => "y.y.y.y"
      records.1:  "y.y.y.y" => "x.x.x.x"
* opentelekomcloud_dns_recordset_v2.swarm: Error updating OpenTelekomCloud DNS  record set: Invalid request due to incorrect syntax or missing required parameters.

Full gist at: https://gist.github.com/patricktoelle/f8a82b644608fb1afca9515e0b777ce4

DNS records were created by terraform. If I delete them from OTC console, they get created correctly, but on next run, same resorting and failing.

Do you have any idea how to solve it or may you need some more information to reproduce?

Error creating instance

Hi,

I am getting error while creating instance using Terraform. Below is the code for instance used by me in Terraform:-
resource "opentelekomcloud_compute_instance_v2" "InstanceWeb1" {
count = "${var.instance_count}"
name = "${var.env}-${var.instanceweb1_name}}"
image_name = "${var.instanceweb1_image}"
flavor_name = "${var.instanceweb1_flavour}"
key_pair = "${opentelekomcloud_compute_keypair_v2.keypair.name}"
security_groups = ["${opentelekomcloud_compute_secgroup_v2.SG1.name}"]
network {
uuid = "${opentelekomcloud_networking_network_v2.network.id}"
}
#tags = ["foo.bar", "tag.value"]
}

Error I am getting is as follows:-

Error applying plan:

1 error(s) occurred:

  • opentelekomcloud_compute_instance_v2.InstanceWeb1: 1 error(s) occurred:

  • opentelekomcloud_compute_instance_v2.InstanceWeb1: Error creating OpenTelekomCloud server: Invalid request due to incorrect syntax or missing required parameters.

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Thanks,
Reena

Error updating key-value tags of an existing ECS

Hi there,

Terraform Version

$ terraform -v
Terraform v0.11.11

  • provider.opentelekomcloud v1.5.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_compute_instance_v2

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

 tag = {
    Key1 = "value1"
    Key2 = "value2"
  }

Expected Behavior

updating key-value tags of an existing ECS

Actual Behavior

opentelekomcloud_compute_instance_v2.default: Error updating OpenTelekomCloud instance tags: Bad request with: [POST https://ecs.eu-de.otc.t-systems.com/v1/XXXXXXXXXXXX/servers/XXXXXXXX/tags/action], error message: {"badRequest": {"message": "Create unified tags failed: tags is required!", "code": 400}}

in order to get it work the ECS need to have at least one tag crated before any add/update operation

Steps to Reproduce

  1. Create an ECS w/o tags
  2. Try to update the tags of the new ECS

Terraform seams to create a wild mixture of resources

Hi there,

From what I saw the debug output look like its everything all right.
But in my https://console.otc.t-systems.com/ it shows: (see Actual Behavior)

Terraform Version

Terraform v0.11.7

  • provider.opentelekomcloud v1.0.0

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_networking_router_interface_v2
  • opentelekomcloud_networking_subnet_v2
  • opentelekomcloud_networking_network_v2

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

variable "username" {}
variable "password" {}
variable "domain_name" {}
variable "tenant_name" {
  default = "eu-de"
}
variable "project" {
  default = "terraformtest"
}
variable "region" {
  default = "eu-de"
}
variable "cidr_private_subnets" {
  default = ["172.18.0.0/24", "172.18.1.0/24"]
}
variable "cidr_public_subnets" {
  default = ["172.19.0.0/24", "172.19.0.0/24"]
}
variable "cidr_subnet_frontend_zone" {
  default = "172.18.0.0/16"
}
variable "cidr_subnet_backend_zone" {
  default = "172.19.0.0/16"
}
variable "lb_method" {
  description = "Methode can be LEAST_CONNECTIONS or ROUND_ROBIN"
  default = "ROUND_ROBIN"
}
variable "lb_provider" {
  # https://www.terraform.io/docs/providers/openstack/r/lb_pool_v1.html#lb_provider
  #
  description = "Provider could be: haproxy, F5"
  default = "haproxy"
}
variable "external_network" {
  description = "Used to create VPC"
  default = "admin_external_net"
}
variable "ext_net_name" {
    description = "name of the external network (do not change)"
    default     = "admin_external_net"
}
variable "service1_count" {
  description = "How many instances of service1_count are spun up"
  default = "1"
}
variable "service1_flavor" {
  description = "Which flavor should be spun for service1"
  default = "s1.medium"
}
variable "image" {
    description = "name of the image to use for the server"
    default     = "Standard_Debian_9_latest"
}
variable "service1_volume_name" {
  default = "myvol"
}
variable "ssh_pub_key" {
  default = "~/.ssh/id_rsa.pub"
}
variable "service1_user_data" {
  default = "hostname -f"
}
variable "endpoint" {
  default = "https://iam.eu-de.otc.t-systems.com:443/v3"
}

main.tf

data "opentelekomcloud_networking_network_v2" "vpc" {
  name = "${var.external_network}"
}
resource "opentelekomcloud_networking_network_v2" "vpc" {
  name           = "${var.project}-vpc"
  admin_state_up = "true"
}
resource "opentelekomcloud_networking_subnet_v2" "private_subnet" {
  network_id = "${opentelekomcloud_networking_network_v2.vpc.id}"
  cidr       = "${var.cidr_private_subnets[0]}"
  region     = "${var.region}"
}
resource "opentelekomcloud_networking_subnet_v2" "public_subnet" {
  network_id = "${opentelekomcloud_networking_network_v2.vpc.id}"
  cidr       = "${var.cidr_public_subnets[0]}"
  region     = "${var.region}"
}
data "opentelekomcloud_networking_network_v2" "extnet" {
  name = "${var.external_network}"
}
resource "opentelekomcloud_networking_router_v2" "router" {
  name             = "Gateway_router"
  region           = "${var.region}"
  external_gateway = "${data.opentelekomcloud_networking_network_v2.extnet.id}"
}
resource "opentelekomcloud_networking_router_interface_v2" "router_int_private" {
  region    = "${var.region}"
  router_id = "${opentelekomcloud_networking_router_v2.router.id}"
  subnet_id = "${opentelekomcloud_networking_subnet_v2.private_subnet.id}"
}
resource "opentelekomcloud_networking_router_interface_v2" "router_int_public" {
  region    = "${var.region}"
  router_id = "${opentelekomcloud_networking_router_v2.router.id}"
  subnet_id = "${opentelekomcloud_networking_subnet_v2.public_subnet.id}"
}

resource "opentelekomcloud_compute_keypair_v2" "keypair" {
  name       = "${var.project}-key"
  public_key = "${file("${var.ssh_pub_key}")}"
}

output "public_subnets" {
  value = ["${opentelekomcloud_networking_subnet_v2.public_subnet.id}"]
}
output "private_subnet" {
  value = ["${opentelekomcloud_networking_subnet_v2.private_subnet.id}"]
}

Debug Output

https://gist.github.com/Moep90/1809f9ad8a155e2955a92c110f8d0e07

Expected Behavior

  • creates VPC with name: terraformtest-vpc
  • Creates two subnets 172.16.18.0/24 / 172.16.19.0/24
  • Creates Router + external Gateway with two interfaces with connected to both subnets
  • Gateway of subnets are 172.16.18.1 / 172.16.19.1

Actual Behavior

  • Creates one subnet with CIDR: 172.19.0.0/24 and Gateway: 172.18.0.1
  • Creates a VPC with name of the router ( Gateway_router )

Picture 1:
otc_topology_gateway
Picture 2:
otc_topology
Picture 3:
otc_vpc_subnets

Steps to Reproduce

  1. terraform apply -var-file=parameter.tfparam

the command of 'make vendor-status' is failed

Terraform Version

any version

Expected Behavior

'make vendor-status' will be success

Actual Behavior

run 'make vendor-status' and output the following errors

The following packages are missing or modified locally:
github.com/aws/aws-sdk-go/aws
github.com/aws/aws-sdk-go/aws/awsutil
github.com/aws/aws-sdk-go/aws/client
github.com/aws/aws-sdk-go/aws/corehandlers
github.com/aws/aws-sdk-go/aws/credentials
github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds
github.com/aws/aws-sdk-go/aws/credentials/endpointcreds
github.com/aws/aws-sdk-go/aws/credentials/stscreds
github.com/aws/aws-sdk-go/aws/defaults
github.com/aws/aws-sdk-go/aws/ec2metadata
github.com/aws/aws-sdk-go/aws/endpoints
github.com/aws/aws-sdk-go/aws/request
github.com/aws/aws-sdk-go/aws/session
github.com/aws/aws-sdk-go/aws/signer/v4
github.com/aws/aws-sdk-go/internal/shareddefaults
github.com/aws/aws-sdk-go/private/protocol
github.com/aws/aws-sdk-go/private/protocol/ec2query
github.com/aws/aws-sdk-go/private/protocol/json
github.com/aws/aws-sdk-go/private/protocol/json/jsonutil
github.com/aws/aws-sdk-go/private/protocol/jsonrpc
github.com/aws/aws-sdk-go/private/protocol/query
github.com/aws/aws-sdk-go/private/protocol/query/queryutil
github.com/aws/aws-sdk-go/private/protocol/rest
github.com/aws/aws-sdk-go/private/protocol/restxml
github.com/aws/aws-sdk-go/private/protocol/xml
github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil
github.com/aws/aws-sdk-go/service/dynamodb
github.com/aws/aws-sdk-go/service/ec2
github.com/aws/aws-sdk-go/service/s3
github.com/aws/aws-sdk-go/service/sts
github.com/gator1/terraform-provider-opentelekomcloud/opentelekomcloud
github.com/gophercloud/gophercloud
github.com/gophercloud/gophercloud/openstack
Error: status failed for 33 package(s)
GNUmakefile:36: recipe for target 'vendor-status' failed
make: *** [vendor-status] Error 2

Steps to Reproduce

run 'make vendor-status'

Unable to find auth_url

Hi,

I am writing terraform template for OpentelekomCloud. I am unable to find the auth_url.
Also, how what is the resource name and syntax for creating VPC and Subnets.

Any suggestion\details on this will be very helpful.

Thanks.

provider.opentelekomcloud: Authentication failed

Hi,

I am trying to connect OpenTelekomCloud using Terraform template.I am getting authentication failure while connecting to cloud. Below is the provider code I am using to connect to OpenTelekomCloud.
variable "username" {}
variable "password" {}
variable "domain_name" {}
variable "endpoint" {}
#variable "vpc_name" {}

provider "opentelekomcloud" {
user_name = "${var.username}"
password = "${var.password}"
#tenant_name = "${var.tenant_name}"
domain_name = "${var.domain_name}"
auth_url = "${var.endpoint}"
}

data "opentelekomcloud_vpc_v1" "vpc" {
name = "Prod-VPC"
region = "eu-de"
cidr = "10.0.0.0/16"
}

I am providing right parameters values to all variables defined.

Any suggestion here would be very helpful.

Thanks,
Reena

Feature: add AK/SK support

This is a feature which propose to add AK/SK configuration support.

*** background ***

Still now, as the README.md[1] descripted, this provider doesn't support AK/SK authentication yet. however, opentelekom cloud has supported AK/SK for a long time[2].

*** Usecase ***

The tenant admin may generate a temporary AK and SK, then delegate others to maintain the resources via terraform tool with the AK/SK. the admin also can set the available time of the AK/SK. this is a safety way that many users expect.

*** what changes ***

SDK changes

As there are two SDKs in this repos, one is gophercloud which can be able to access to opentelekom cloud services via OpenStack compatible API. another one is huaweicloud/golangsdk which can be able to access to other services that can not be supported by gophercloud. however, gophercloud doesn't have AK/SK feature.

aksk is basic function in SDK, it should be supported for all services. so we have to move all services from gophercloud into huaweicloud/golangsdk. that all AK/SK feature will be added into huaweicloud/golangsdk and gophercloud will be removed from this dependencies.

Configuration changes

This feature will not change the configuration options of each resource or data source. and will not add any further option for provider configuration. the things that you may know:
currently, the configuration of provider already have AK/SK option. but it was only used to access to OBS service. username/password also needed.after this PR, if it has the AK/SK option, the username/password will not work any more. that means the AK/SK has a high priority than username/password.

Compact Analysis

if you have scripts only configuration username/password. there will not have any compact. if you configuration provider both username/password and aksk, we suggest to remove username/password and make sure the aksk is correct.

Terraform Version
any

Affected Resource(s)
Please list the resources as a list, for example:
all

References
[1]/README.md@master#quick-start
[2]https://docs.otc.t-systems.com/en-us/usermanual/obs/en-us_topic_0045853757.html

[REQUEST] Enable ELB/RDS/etc. to set specific internal-address

Terraform Version

$ terraform -v
Terraform v0.11.7

Affected Resource(s)

Please list the resources as a list, for example:

  • opentelekomcloud_elb_loadbalancer
  • opentelekomcloud_rds_instance_v1

Terraform Configuration Files

A possible solution could be:
(keep parameter in line with the ec2 ones fixed_ip_v4 )

resource "opentelekomcloud_elb_loadbalancer" "load_balancer" {
  name                 = "${var.project}-${terraform.workspace}-elb"

  [...]

  vip_address       = "${var.elb_external_ip}"
  fixed_ip_v4        = "${var.elb_internal_ip}"
}

or for RDS:

resource "opentelekomcloud_rds_instance_v1" "instance" {
  name              = "${var.project}-${terraform.workspace}-rds-instance"

   [...]

  nics {
    subnetid        = "${opentelekomcloud_networking_network_v2.vpc.id}"
    fixed_ip_v4    = "${var.rds_internal_ip}"
  }
}

Expected Behavior

Ability givven to set both, the RDS/ELB access/(private) address eg.: 192.168.16.100

Actual Behavior

There is no parameter so far.

Error: opentelekomcloud_rds_instance_v1.instance: nics.0: invalid or unknown key: fixed_ip_v4

Add a new lib of 'golangsdk'

golangsdk[1] is a lib like gophercloud, which is the go sdk for huawei cloud. This issue want to import it as a lib, which will be more suitable than gophercloud to develop the apps belonging to opentelekom cloud.

Terraform Version

any(not request fix verison)

Affected Resource(s)

All resources whose apis are different than the native openstack's should use the golangsdk instead.

References

[1] https://github.com/huaweicloud/golangsdk

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.