terraform-provider-flux icon indicating copy to clipboard operation
terraform-provider-flux copied to clipboard

Terraform fails to import flux_bootstrap_git

Open anupclouddevops opened this issue 9 months ago • 0 comments

I am getting the below error while importing flux_bootstrap_git resource into terraform state

╷ │ Error: Could not get GitRepository flux-system/flux-system │ │ failed to get API group resources: unable to retrieve the complete list of server APIs: source.toolkit.fluxcd.io/v1: the server │ could not find the requested resource ╵

I am trying to upgrade Terraform Flux provider from 0.21.0 to 1.1.0 i.e from old bootstrap method to new bootsrap resource.

I followed the migration guide and get the above error while importing the flux_bootstrap_git resource. My Flux controllers are on v0.37.0 and only v1beta1 and v1beta2 CRDs installed. As per the migration guide , I kept the Flux version as it is and only upgrading terraform provider to the new bootstrap resource. However, looks like the provider is looking for v1 CRDs which are only available in FluxCD v2.x.

I also tried downgrading Flux Client to v0.37.0 to match the server version. $ flux version flux: v0.37.0 helm-controller: v0.27.0 kustomize-controller: v0.31.0 notification-controller: v0.29.0 source-controller: v0.32.1

PS: I do want to upgrade FluxCD to a new version too but the migration guide suggests to upgrade the provider first and then Flux CD.

Please let me know if you need more information.

anupclouddevops avatar Sep 19 '23 22:09 anupclouddevops