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

Update SDKs

Open fabiomatavelli opened this issue 2 years ago • 20 comments

Update of SDKs and Go version:

  • Go v1.21
  • Terraform SDK from v1 to v2
  • Cloudstack SDK from v2.13.2 to v2.16.0

The acceptance tests are still failing but the provider is compiling without any problem. All the necessary adjustments were made to make it work with the new terraform SDK.

fabiomatavelli avatar Aug 19 '23 12:08 fabiomatavelli

resolves https://github.com/apache/cloudstack-terraform-provider/issues/66

poddm avatar Nov 28 '23 20:11 poddm

If there is going to be SDK updates, why not just go to the Terraform Plugin Framework instead?

CodeBleu avatar Feb 16 '24 05:02 CodeBleu

Rekicking build check

rohityadavcloud avatar Feb 19 '24 20:02 rohityadavcloud

If there is going to be SDK updates, why not just go to the Terraform Plugin Framework instead?

I believe when these changes were created Hashcorp was still recommending SDKv2.

poddm avatar Feb 29 '24 18:02 poddm

If there is going to be SDK updates, why not just go to the Terraform Plugin Framework instead?

I believe when these changes were created Hashcorp was still recommending SDKv2.

Yes, that was my understanding. I was just wondering if it's worth still merging this, or move to the Terraform Plugin Framework instead. I figured if there was going to be effort to merge in a "refactor", might as well be the latest method, don't you think?

I also think that something like this ( refactor ) would make more sense to be the v0.5.0, but for now it would be nice to get a v0.4.x out with the latest updates that are already commited.

CodeBleu avatar Feb 29 '24 22:02 CodeBleu

Indeed, I haven't seen the Terraform Plugin Framework at the time I did it. If you think it is better to go straight to it, then I can close this one @CodeBleu @poddm as I'm not sure I'll have time to work on it.

fabiomatavelli avatar Mar 03 '24 18:03 fabiomatavelli

@CodeBleu I was looking into migrating directly to the terraform plugin framework and it will require a huge effort for that. It will be not as simple as migrating from v1 to v2. So my proposal is to continue the migration to sdkv2 to, at least, have a more recent version of the SDK, then start working on the migration to the plugin framework.

I've already implemented some new things in my contribution, like muxing the provider and the terraform plugin testing in tests, so then it will be easier to migrate to the plugin framework.

fabiomatavelli avatar Mar 15 '24 19:03 fabiomatavelli

@vishesh92 @rohityadavcloud I've added another matrix to the acceptance test so multiple versions of terraform can be tested.

fabiomatavelli avatar Mar 15 '24 19:03 fabiomatavelli

@CodeBleu I was looking into migrating directly to the terraform plugin framework and it will require a huge effort for that. It will be not as simple as migrating from v1 to v2. So my proposal is to continue the migration to sdkv2 to, at least, have a more recent version of the SDK, then start working on the migration to the plugin framework.

I've already implemented some new things in my contribution, like muxing the provider and the terraform plugin testing in tests, so then it will be easier to migrate to the plugin framework.

@fabiomatavelli TF Plugin be a v0.7.0 milestone?

CodeBleu avatar Mar 15 '24 23:03 CodeBleu

@fabiomatavelli TF Plugin be a v0.7.0 milestone?

@CodeBleu could be, but I'll let @rohityadavcloud decide on that. Also with muxing the migration can be partial, doing few resources/datasources on each release.

fabiomatavelli avatar Mar 16 '24 14:03 fabiomatavelli

@fabiomatavelli can you resolve the conflicts, thanks. I've approved the Github actions to start running tests, thanks for the PR.

rohityadavcloud avatar Apr 26 '24 04:04 rohityadavcloud

Done @rohityadavcloud

fabiomatavelli avatar Apr 26 '24 07:04 fabiomatavelli

Thanks @fabiomatavelli tests kicked, let's see what Github actions do.

rohityadavcloud avatar Apr 26 '24 07:04 rohityadavcloud

@rohityadavcloud I've added the OpenTofu acceptance test CI also as suggested by @CodeBleu . If you can allow the actions again so we can check the run 🙏

fabiomatavelli avatar Apr 27 '24 10:04 fabiomatavelli

Looks like the opentofu/setup-opentofu@v1 action is not allowed. Is it possible to allow it @rohityadavcloud ?

fabiomatavelli avatar Apr 27 '24 15:04 fabiomatavelli

@fabiomatavelli the ASF infra doesn't allow any actions to be used, if it's not running, likely it's not allow. Can you send me (list of?) all the GitHub Actions you want to use, I can request ASF infra to add/allow them for use in apache/cloudstack* repos.

rohityadavcloud avatar Apr 28 '24 08:04 rohityadavcloud

@rohityadavcloud those are the ones that we are using in the acceptance test CI:

  • actions/setup-go@v5
  • hashicorp/setup-terraform@v3
  • opentofu/setup-opentofu@v1

From the error message that we got, looks like the only one not allowed was the setup-opentofu, as you can see here.

fabiomatavelli avatar Apr 28 '24 11:04 fabiomatavelli

@fabiomatavelli done I've raised the ticket here - https://issues.apache.org/jira/browse/INFRA-25753

rohityadavcloud avatar Apr 29 '24 06:04 rohityadavcloud

@fabiomatavelli the infra team has enabled the action, I’ve closed and reopened the PR to try again.

rohityadavcloud avatar May 07 '24 15:05 rohityadavcloud

@rohityadavcloud thanks, it's working now

fabiomatavelli avatar May 07 '24 16:05 fabiomatavelli

@poddm @fabiomatavelli @rohityadavcloud What are we waiting on to get this updated? I was looking into testing some other stuff and noticed the version of the cloudstack-go version is really old in the terraform provider (2.13.2) and was trying to get that resolved locally for testing things and then remembered this was out here.

image

image

CodeBleu avatar Jun 07 '24 16:06 CodeBleu

@poddm @fabiomatavelli @rohityadavcloud What are we waiting on to get this updated? I was looking into testing some other stuff and noticed the version of the cloudstack-go version is really old in the terraform provider (2.13.2) and was trying to get that resolved locally for testing things and then remembered this was out here.

image

image

I approved it awhile back. All of my open PRs are dependent on updating the cloudstack-go SDK.

poddm avatar Jun 07 '24 16:06 poddm

@poddm @rohityadavcloud what is the next step then? Can we merge it? It's all good to be merged so we can continue working on other PRs

fabiomatavelli avatar Jun 07 '24 23:06 fabiomatavelli

@fabiomatavelli @poddm I am running a little busy these days. Let me review this PR by next week.

vishesh92 avatar Jun 13 '24 17:06 vishesh92

@fabiomatavelli I have reviewed the PR. Changes looks good. I have left comments where I have some questions about the changes. Apart from this, there are sinor code style issues related to indentation at some places which is due to tabs and spaces.

vishesh92 avatar Jun 14 '24 06:06 vishesh92

@vishesh92 issues fixed

fabiomatavelli avatar Jun 14 '24 16:06 fabiomatavelli

@vishesh92 can you merge this now? I feel like it should be a simple pressing of the merge button at this point, no? 😉

CodeBleu avatar Jun 20 '24 19:06 CodeBleu