Skip to content

Conversation

@miton18
Copy link
Contributor

@miton18 miton18 commented Apr 17, 2025

  • install clever-tools from this PR
  • install TF
  • write provider.tf
  • run terraform init
  • run clever-tools generate terraform -o orga_xxx > import.tf
  • terraform plan -generate-config-out=generated.tf
  • generated.tf must have all your resources

provider.tf

terraform {  
  required_providers {
    clevercloud = {
      source = "CleverCloud/clevercloud"
      version = "0.7.1"
    }
  }
}
 
provider "clevercloud" {
   # Configuration options
}

Some imports fails see CleverCloud/terraform-provider-clevercloud#134

@miton18 miton18 requested a review from a team as a code owner April 17, 2025 15:01
@miton18 miton18 force-pushed the feat/tf-import branch 2 times, most recently from c95b03a to d79a490 Compare April 17, 2025 15:52
@github-actions
Copy link

github-actions bot commented Apr 17, 2025

🔎 A preview has been automatically published:

  • 🐧 linux 7fdc3af9e12b65cfd8d062951485967ee02523bb3d72c67cdb50002a71e06a76
  • 🍏 macos 159b962f2298602ed9b41157bcf87550f726ed15dc00f674b0dd8ab659c0b5be
  • 🪟 win fb7f073c3087bbe82e893b89627e799fe2bd663a68cd0230da4c510e39055df5

This preview will be deleted once this PR is closed.

@miton18 miton18 force-pushed the feat/tf-import branch 2 times, most recently from ba7d284 to 23482a3 Compare April 23, 2025 16:59
if (instanceType === 'node') {
instanceType = 'nodejs';
}
if (instanceType === 'java' && app.variantSlug === 'sbt') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool !

}

let id = addon.realId;
if (addon.resourceKind === 'mongodb') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there seems to be the same issue with postgresql_UUID ids.

Also, running the binaries from "preview" I did not see any effect of this code.
Should it happen after resourceKind: providerId.replaceAll('-addon', '').replaceAll('addon-', '') ?

@gnoireaux
Copy link

Hello @miton18 ,

Rachel asked me to put my feedback here.
Thanks for your work ! It's useful for us not to have to spend hours copy-pasting. (and making mistakes!)

It would be quite useful to get the env. vars. too ! (and dependancies if possible) But maybe it is a job on Terraform's side ?

@gnoireaux
Copy link

Cellar

It's not so important (for us since we don't have so many cellars) but for your information, there is an issue with cellar's

terraform outputs an error to the console:

│ Error: Missing Configuration for Required Attribute
│
│   with clevercloud_cellar.cellardevstghds-cellar,
│   on generated.tf line 1:
│   (source code not available)
│
│ Must set a configuration value for the name attribute as the provider has marked it as required.
│
│ Refer to the provider documentation or contact the provider developers for additional information about configurable attributes that are
│ required.

and the file's contents aren't so helpful

# __generated__ by Terraform
resource "clevercloud_cellar" "cellardevstghds-cellar" {
  name   = null
  region = null
}

@gnoireaux
Copy link

PG (FYI)

modified by hand:

# ztest-ubilab-playground-for-restore
import {
  to = clevercloud_postgresql.ztest-ubilab-playground-for-restore
  id = "addon_f9a55fce-af2e-418c-bded-58c6b04e38cb"
}

ran terraform, with similar error than for a cellar

│ Error: Missing Configuration for Required Attribute
│
│   with clevercloud_postgresql.ztest-ubilab-playground-for-restore,
│   on generated.tf line 1:
│   (source code not available)
│
│ Must set a configuration value for the name attribute as the provider has marked it as required.
│
│ Refer to the provider documentation or contact the provider developers for additional information about configurable attributes that are
│ required.

there is a bit more content in the file generated.tf

# __generated__ by Terraform
resource "clevercloud_postgresql" "ztest-ubilab-playground-for-restore" {
  name   = null
  plan   = "s_hug"
  region = "par"
}

@hsablonniere hsablonniere added this to the 3.14 milestone May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants