cf-terraforming icon indicating copy to clipboard operation
cf-terraforming copied to clipboard

import cloudflare_load_balancer_* is not working

Open unkls opened this issue 3 years ago • 5 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the library and it is still present.

cf-terraforming version

cf-terraforming v0.6.3

Expected outcome

I've expected to get the terraform import command for my load_balancer (pool, monitor, load_balancer) ressources. It was working like a charm for records ressources.

Actual outcome

"cloudflare_load_balancer_pool" is not yet supported for state import

"cloudflare_load_balancer_monitor" is not yet supported for state import

"cloudflare_load_balancer" is not yet supported for state import

Steps to reproduce

I've ust generate command first and it was working fine

 cf-terraforming generate -z <MY_ZONE_ID> --resource-type cloudflare_load_balancer_pool --account <MY_ACCOUNT_ID> --key <MY_API_KEY> --email <MY_EMAIL>

That show me all my pools and then I try

cf-terraforming import -z <MY_ZONE_ID>  --resource-type cloudflare_load_balancer_pool --account <MY_ACCOUNT_ID> --key <MY_API_KEY> --email <MY_EMAIL>

That show me an error.

Do someone have an idea ? As the README show load balancer ressources should be handled by this tool ?

Thanks a lot in advance

References

No response

unkls avatar Jan 19 '22 10:01 unkls

I can confirm this issue is replicated in our environment as well. Are there any updates on this?

silviuebi avatar Feb 09 '22 13:02 silviuebi

Same here; Using the latest version 0.6.3 cloudflare_load_balancer is generated fine, not importable, hence trying to "create" it on terraform plan stage.

Any updates?

osipov-vadim avatar Mar 29 '22 17:03 osipov-vadim

Looking at this instead https://github.com/cloudflare/terraform-provider-cloudflare/issues/70

everops-miked avatar Jul 01 '22 20:07 everops-miked

This is still a problem when using cf-terraforming version 0.16.1 and provider version v4.20.0.

The following attributes are not imported and comes up during terraform plan

+ session_affinity_ttl = XXXX

+ adaptive_routing {
    + failover_across_pools = XXXX
  }

+ location_strategy {
    + mode       = XXXX
    + prefer_ecs = XXXX
  }

+ random_steering {
    + default_weight = XXXX
  }

+ session_affinity_attributes {
    + drain_duration         = XXXX
    + headers                = XXXX
    + require_all_headers    = XXXX
    + samesite               = XXXX
    + secure                 = XXXX
    + zero_downtime_failover = XXXX
  }

vipulagarwal avatar Dec 13 '23 12:12 vipulagarwal

I can't reproduce it using these versions and provider.tf. Maybe my findings will help you with solving this issue.

➜  cloudflare_zone git:(master) terraform version
Terraform v1.8.5
on linux_amd64
+ provider registry.terraform.io/cloudflare/cloudflare v4.35.0
➜  cloudflare_zone git:(master) ./cf-terraforming version
cf-terraforming v0.20.0

➜  cloudflare_zone git:(master) cat provider.tf
terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 4.0"
    }
  }
}

provider "cloudflare" {
}

Import and generate works as expected:

./cf-terraforming generate -a $CLOUDFLARE_ACCOUNT_ID --email [email protected] --resource-type cloudflare_load_balancer_pool --token $CLOUDFLARE_API_TOKEN 
./cf-terraforming import -a $CLOUDFLARE_ACCOUNT_ID --email [email protected] --resource-type cloudflare_load_balancer_pool --token $CLOUDFLARE_API_TOKEN

I suggest creating a token with the correct permissions as listed below and then trying to use -a or --account instead of -z or --zone.

Token permissions:

My Enterprise Account - Load Balancing: Monitors And Pools:Edit
All zones - Zone:Edit, Load Balancers:Edit

Please keep in mind that Loadbalancers are in the Zone scope, and Monitors And Pools are in the Account scope.

sojakub avatar Jun 21 '24 16:06 sojakub