Skip to content

Inconsistent Suffix Sequencing (_0, _1, ...) between generate and import commands for cloudflare_ruleset #938

@Tonwins

Description

@Tonwins

Confirmation

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

cf-terraforming version

cf-terraforming v0.24.0

Expected outcome

The sequence of numerical suffixes (_0, _1, _2, ...) assigned to resources with specific UUIDs should be identical between the generate and import commands. A resource with UUID 89a88396baa442d1bd1ff32aa9b61af9 should get the same suffix (e.g., _0) in both the generated .tf file and the generated import command.

Actual outcome

The cf-terraforming generate and cf-terraforming import commands generate different sequences of numerical suffixes for resources with the same UUID. This inconsistency makes the generated import commands fail because they reference Terraform resource names that do not exist in the generated configuration.

Steps to reproduce

  1. Generate Terraform configuration for a zone's rulesets:
cf-terraforming generate --zone ZONE_ID --resource-type "cloudflare_ruleset"

Example Output:

resource "cloudflare_ruleset" "terraform_managed_resource_89a88396baa442d1bd1ff32aa9b61af9_0" {...}
resource "cloudflare_ruleset" "terraform_managed_resource_269d01abe1644cf495083cae5fc56cc1_1" {...}
resource "cloudflare_ruleset" "terraform_managed_resource_0c4988c4462845f1b257e930eb95e20b_2" {...}
resource "cloudflare_ruleset" "terraform_managed_resource_817a22612e8743f0bea05d286e7e31fb_3" {...}
resource "cloudflare_ruleset" "terraform_managed_resource_619f74f5156a421ea88388de1f7f6da3_4" {...}
  1. Generate import commands for the same zone and resource type:
cf-terraforming import --zone ZONE_ID --resource-type "cloudflare_ruleset"

Example Output:

terraform import cloudflare_ruleset.terraform_managed_resource_269d01abe1644cf495083cae5fc56cc1_0 ...
terraform import cloudflare_ruleset.terraform_managed_resource_619f74f5156a421ea88388de1f7f6da3_1 ...
terraform import cloudflare_ruleset.terraform_managed_resource_817a22612e8743f0bea05d286e7e31fb_2 ...
terraform import cloudflare_ruleset.terraform_managed_resource_0c4988c4462845f1b257e930eb95e20b_3 ...
terraform import cloudflare_ruleset.terraform_managed_resource_89a88396baa442d1bd1ff32aa9b61af9_4 ...
  1. Run any of the generated terraform import commands. The command will fail because the resource address (e.g., ..._89a883..._4) does not match the name defined in the configuration file (e.g., ..._89a883..._0).
  • cf-terraforming version: v0.24.0

  • provider cloudflare/cloudflare v4.52.5

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions