Giter Club home page Giter Club logo

terraform-provider-ccloud's Introduction

Converged Cloud - Terraform Provider

Documentation: registry.terraform.io

Maintainers

This provider plugin is maintained by:

Requirements

  • Terraform 1.0.x
  • Go 1.22 (to build the provider plugin)

Usage

The CCloudEE provider is an extension to the OpenStack Terraform Provider. It provides resources that allow to use Terraform for Converged Cloud's additional services:

  • Kubernikus (Kubernetes as a Service)
  • Arc for Arc resources management
  • Lyra for Automation management
  • Billing for Billing management
  • Andromeda for GSLB / GTM (Global Server Load Balancing / Global Traffic Management)
  • Archer for Endpoint Services

The provider needs to be configured with the proper OpenStack credentials before it can be used. For details see the OpenStack provider.

Building The Provider

Clone the repository

$ git clone [email protected]:sapcc/terraform-provider-ccloud

Enter the provider directory and build the provider

$ cd terraform-provider-ccloud
$ make build

Installing the provider

To install this provider, copy and paste this code into your Terraform configuration. Then, run terraform init.

terraform {
  required_providers {
    ccloud = {
      source = "sapcc/ccloud"
    }
  }
}

provider "ccloud" {
  # Configuration options
}

Using the provider

Please see the documentation at registry.terraform.io.

Or you can browse the documentation within this repo here.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.20+ is required).

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

$ make build

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

$ make test

Releasing the Provider

This repository contains a GitHub Action configured to automatically build and publish assets for release when a tag is pushed that matches the pattern v* (ie. v0.1.0).

A Gorelaser configuration is provided that produce build artifacts matching the layout required to publish the provider in the Terraform Registry.

Releases will as drafts. Once marked as published on the GitHub Releases page, they will become available via the Terraform Registry.

terraform-provider-ccloud's People

Contributors

bugroger avatar carthaca avatar dependabot[bot] avatar janosbinder avatar jknipper avatar kayrus avatar majewsky avatar nuckal777 avatar onuryilmaz avatar renovate[bot] avatar supersandro2000 avatar

Stargazers

 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  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

terraform-provider-ccloud's Issues

Not possible to specify floating IP subnet when creating kubernikus cluster

Hi there,

when creating a kubernikus cluster in ccloud there is no option to specify the subnet for the external network from which the floating IP of a loadbalancer will be assigned. There is an argument for the openstack block called lB_subnet_id, but this specifies the subnet of the private network. Because of this missing option when the external network has several subnets the floating IP will be assigned from one of these subnets randomly.

Terraform Version

Terraform v0.11.13

  • provider.ccloud v1.4.7
  • provider.environment v1.0.0
  • provider.external v1.1.2
  • provider.helm v0.10.2
  • provider.kubernetes v1.7.0
  • provider.openstack v1.18.0

Affected Resource(s)

ccloud_kubernetes_v1

Expected Behavior

When a loadbalancer is created for a kubernetes service the floating IP is taken from the specified subnet of the external network.

Actual Behavior

Loadbalancer is created with a floating IP taken from a random subnet of the external network

Steps to Reproduce

terraform apply

References

sapcc/kubernikus#434

Terraform v0.12 compatibility

Hi there,

Terraform just released version 0.12 and I wanted to try it out. Unfortunately, the ccloud provider is not yet compatible

Terraform Version

Terraform v0.12.0

  • provider.ccloud v1.0.0
  • provider.openstack v1.19.0

Affected Resource(s)

terraform-provider-ccloud

Debug Output

Error: Failed to instantiate provider "ccloud" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]

Steps to Reproduce

Install Terraform v0.12.0 from https://www.terraform.io/downloads.html and run terraform plan on your tf code. Terraform init works fine.

Thanks!

quota apply hangs when domain_id and region_id not set

domainID := d.Get("domain_id").(string)
projectID := d.Get("project_id").(string)
services := limesresources.QuotaRequest{}
log.Printf("[DEBUG] Updating Quota for: %s/%s", domainID, projectID)

Above snippet doesnt check if domain_id and region_id exists. Updating Quota for: /:

2023-11-03T08:41:05.341+0100 [INFO]  Starting apply for module.resource_limits.ccloud_quota_project_v1.project_resource_limits
2023-11-03T08:41:05.343+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:05 [DEBUG] Updating Quota for: /: timestamp=2023-11-03T08:41:05.343+0100

The output hangs on waiting for active state.

2023-11-03T08:41:05.794+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:05 [DEBUG] compute.instances: {40 }: timestamp=2023-11-03T08:41:05.793+0100
2023-11-03T08:41:05.794+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:05 [DEBUG] Service Changed: volumev2: timestamp=2023-11-03T08:41:05.793+0100
2023-11-03T08:41:05.794+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:05 [DEBUG] Waiting for state to become: [active]: timestamp=2023-11-03T08:41:05.793+0100
2023-11-03T08:41:07.051+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:07 [TRACE] Waiting 1s before next try: timestamp=2023-11-03T08:41:07.051+0100
2023-11-03T08:41:08.156+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:08 [TRACE] Waiting 2s before next try: timestamp=2023-11-03T08:41:08.155+0100
2023-11-03T08:41:10.257+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:10 [TRACE] Waiting 4s before next try: timestamp=2023-11-03T08:41:10.256+0100
2023-11-03T08:41:14.369+0100 [INFO]  provider.terraform-provider-ccloud_v1.5.1: 2023/11/03 08:41:14 [TRACE] Waiting 8s before next try: timestamp=2023-11-03T08:41:14.368+0100
module.resource_limits.ccloud_quota_project_v1.project_resource_limits: Still creating... [10s elapsed]

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/golangci-lint.yml
  • actions/setup-go v5
  • actions/checkout v4
  • golangci/golangci-lint-action v6
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-go v5
  • crazy-max/ghaction-import-gpg v6.1.0
  • goreleaser/goreleaser-action v6
gomod
go.mod
  • go 1.22.5
  • github.com/go-openapi/runtime v0.28.0
  • github.com/go-openapi/strfmt v0.23.0
  • github.com/go-openapi/validate v0.24.0
  • github.com/gophercloud/gophercloud/v2 v2.0.0
  • github.com/gophercloud/utils/v2 v2.0.0-20240705071316-780b64d153e3@780b64d153e3
  • github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
  • github.com/sapcc/andromeda v0.0.2-0.20240718140407-a893a7fcea3c@a893a7fcea3c
  • github.com/sapcc/archer v1.2.1-0.20240711183110-302e2bbe3533@302e2bbe3533
  • github.com/sapcc/gophercloud-sapcc/v2 v2.0.2
  • github.com/sapcc/kubernikus v1.0.1-0.20240619130954-d2e31494f91c@d2e31494f91c
  • k8s.io/client-go v0.30.3
  • sigs.k8s.io/yaml v1.4.0

  • Check this box to trigger a request for Renovate to run again on this repository

ccloud_billing_project_masterdata update

Good day, colleagues.

Looks like the ccloud_billing_project_masterdata resource has been changed and now it contains new mandatory parameters - Asset Owner (Primary Contact), Run Team (Operator), Inventory Role, and Project info. Could you please update it in the provider?

Thanks a lot in advance.

Compatibility with TF 0.13

Hello, colleagues.

I'd like to ask if the current implementation of the provider is compatible with TF 0.13?

As far as I understand, the new version of Terraform is able to download and install providers directly from GitHub, and it would be great if that feature would be supported by ccloud provider as well.

Thanks!

Changing size of Kubernikus cluster causes error

Hi!

When I try to resize a pool inside of a Kubernikus cluster (change the number of instances), an error message is emitted.

Terraform Version

Terraform v0.11.8

  • provider.ccloud (unversioned)
  • provider.openstack (unversioned)

Affected Resource(s)

  • ccloud_kubernetes

Terraform Configuration Files

02_varibales.tf

# Define variables to be used in resource definitions
variable "name_prefix" {}

variable "private_subnet_cidr" {}
variable "private_subnet_ipv" {}

variable "k8s_pool1_name" {}
variable "k8s_pool1_flavor" {}
variable "k8s_pool1_size" {}

variable "sg_default_name" {}

23_main_k8s.tf

# k8s
resource "ccloud_kubernetes" "k8s" {
  name           = "${var.name_prefix}"
  ssh_public_key = "<some_key>"

  node_pools = [
    { 
      name   = "${var.k8s_pool1_name}"
      flavor = "${var.k8s_pool1_flavor}"
      size   = "${var.k8s_pool1_size}"
    },    
  ]

  depends_on = [
    "openstack_networking_router_v2.kuberouter",
    "openstack_networking_router_interface_v2.kuberouter_interface",
  ]
}

conf/qa.tfvars

name_prefix = "uxp-qa"

private_subnet_cidr = "10.180.0.0/24"
private_subnet_ipv = 4

k8s_pool1_name = "pool1"
k8s_pool1_flavor = "m1.4xlarge"
k8s_pool1_size = 3

sg_default_name = "default"

Debug Output

https://gist.github.com/UncleIS/615649bca972be5cf99f7e9bff8743e2

Expected Behavior

The number of instances in the pool should have been updated.

Actual Behavior

An error was thrown:

Terraform will perform the following actions:

  ~ ccloud_kubernetes.k8s
      node_pools.0.size: "4" => "3"


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

ccloud_kubernetes.k8s: Modifying... (ID: uxp-qa)
  node_pools.0.size: "4" => "3"

Error: Error applying plan:

1 error(s) occurred:

* ccloud_kubernetes.k8s: 1 error(s) occurred:

* ccloud_kubernetes.k8s: Error updating cluster: method PUT is not allowed, but [POST,GET] are

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.

Steps to Reproduce

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

  1. Update the amount of instances that form a Kubenikus cluster pool
  2. Run 'terraform apply'

Important Factoids

Running in SAP Converged Cloud offering

Remove few attributes for arc agent resource

Good day colleagues,

Is it possible to remove few attributes for arc agent resource https://github.com/sapcc/terraform-provider-ccloud/blob/master/ccloud/data_source_ccloud_arc_agent_v1.go#L83-L91 ?

The reason: In terraform v.1 the output of terraform plan command was changed and now it shows not only resources which will be changed but and resources that were changed outside the terraform. It is great behaviour and helps to work with drifts. But now we have some computed attributes for arc agent resource that predictably changes from time to time outside the terraform automatically and as a result, we have information about it in every terraform plan output. It creates excessive noise in the plan command output.

  ~ resource "ccloud_arc_agent_v1" "app" {
      ~ updated_at   = "2021-09-14T10:01:18Z" -> "2021-09-21T11:07:18Z"
      ~ updated_with = "6ca72b40-debe-4ea5-95d3-6d6bd473d0cb" -> "bf261711-e333-40ab-848d-dc66c03bff9d"

The only way to prevent seeing those changes would be for the provider to not report them in response to refreshing. Terraform reports any change that the provider reports, and so it’s the generally provider’s responsibility to only report useful information which is relevant to the settings being managed by Terraform.

Due to those two attributes constantly change even though you’re not changing anything about the infrastructure with Terraform then it seems like there’s little value in the provider actually tracking them, and so we could drop those attributes altogether in a future release, in order to reduce the noise and focus the change reports only on data that’s actually relevant to the task of managing these objects with Terraform.

Could you please drop it in the new release or should we build it ourself without these attributes?

Thanks a lot in advance and Regards,
Aleksandr

Adding triggers to ccloud_arc_agent_bootstrap_v1 creates Terraform cycle

Hello,

When I'm adding triggers for agent bootstrap that should re-create this resource before VM replacement, I'm getting Terraform cycle.

Error: Cycle: ccloud_arc_agent_bootstrap_v1.splunk, openstack_compute_instance_v2.splunk

Terraform Version

Terraform v1.5.0
on darwin_arm64

  • provider registry.terraform.io/hashicorp/null v3.2.1
  • provider registry.terraform.io/sapcc/ccloud v1.4.18
  • provider registry.terraform.io/terraform-provider-openstack/openstack v1.51.1

Affected Resource(s)

  • ccloud_arc_agent_bootstrap_v1
  • openstack_compute_instance_v2

Terraform Configuration Files

resource "ccloud_arc_agent_bootstrap_v1" "splunk" {
  triggers = {
    vm_id = openstack_compute_instance_v2.splunk.id
  }
}

resource "openstack_compute_instance_v2" "splunk" {
  name                   = var.vm_name
  key_pair              = var.keypair
  availability_zone = var.availability_zone
  flavor_id              = data.openstack_compute_flavor_v2.splunk.id
  image_id             = var.image.id

  security_groups = var.security_groups

  network {
    name = var.private_network-name
  }

  user_data = ccloud_arc_agent_bootstrap_v1.splunk.user_data

  connection {
    type                           = "ssh"
    bastion_host             = var.jump_servers[var.domain_name]
    bastion_user             = var.user_name
    bastion_private_key = local.private_key
    host                           = self.access_ip_v4
    user                           = var.provisioning_user_name
    private_key               = local.private_key
  }

  metadata = {
    image_name = var.image.name
    image_id       = var.image.id
  }

  tags = var.tags
}

Same issue appears if I replace triggers with lifecycle from agent bootstrap, a cycle also appears.

  lifecycle {
    replace_triggered_by = [openstack_compute_instance_v2.splunk]
  }

Expected Behavior

Bootstrap agent resource is re-created along with VM replacement.

Actual Behavior

Terraform cycle

Steps to Reproduce

  1. terraform validate
  2. terraform plan

Add support for Kubernikus multi-availability-zones feature

Hello, colleagues.

It would be nice to add the support of mutli-availability-zones feature that Kubernikus received recently.

My assumption is that the feature should go somewhere here:

"node_pools": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validatePoolName(),
},
"flavor": {
Type: schema.TypeString,
Required: true,
},
"image": {
Type: schema.TypeString,
Optional: true,
Default: "coreos-stable-amd64",
},
"size": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
ValidateFunc: validation.IntAtMost(127),
},
},
},
},

Thanks!

billing scope autodetect is broken

we are getting the next error
Error getting billing project masterdata: Request forbidden: [GET https://billing.eu-de-2.cloud.sap:64000/masterdata/projects], error message: {"Error":{"status":403,"message":"Only project-admins are allowed to get the costobject for a project!"}}
As you could see the project ID is missed in the request. If I understand correctly it should be https://billing.eu-de-2.cloud.sap:64000/masterdata/projects/ID_OF THE_PROJECT

Thanks a lot in advance.

Originally posted by @ashkraba in #65 (comment)

Add support for CCloud automation management

Hello, colleagues.

This is a feature request to introduce support for automation management in CCloud with Terraform: it is desired to:

  • Add instances to automation at the time of instance creation;
  • Manage automations (create / modify / delete)

Thanks!

Add builds for darwin_arm64 platform

It would be really nice to have builds for darwin_arm64 since it will allow using this Terraform module on Macbooks with Apple chip.
Thanks in advance.

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.