-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: migrate to tf-sdk2 #102
Conversation
Have a look at some of the changes in #23. You will need to actually use the new context param for it to be effective. |
Thanks for pointing out! I made the rough changes yesterday and now I'll go for the details |
9e9e9d9
to
ed94aaf
Compare
eecea6e
to
3e82110
Compare
Type: schema.TypeMap, | ||
Type: schema.TypeList, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State Migration should be implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out :) So for all TypeMap
to TypeList
we need those migrators right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- tested locally with unit tests and
- as described in the
contributing
section (I wonder how we can automate those tests)
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
#version = "2.8.0"
version = "9.9.9"
}
}
}
provider "docker" {
}
resource "docker_image" "foo" {
name = "nginx:latest"
keep_locally = true
}
resource "docker_service" "foo" {
name = "foo"
task_spec {
container_spec {
image = docker_image.foo.latest
stop_grace_period = "10s"
}
# v2.8.0
#restart_policy = {
# v9.9.9
restart_policy {
condition = "on-failure"
delay = "3s"
max_attempts = 4
window = "10s"
}
}
endpoint_spec {
ports {
target_port = "80"
published_port = "8080"
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Would you split files per schema version like docker_container
resource?
- resource_docker_service.go
- resource_docker_service_v1.go
- resource_docker_service_v0.go
I did the same in thing hashicorp/terraform-provider-docker#272 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to move docker
package to internal/provider
for SDK migration?
Great work! IMHO, we should do one thing in one pull request. I don't think we should split this pull request forcibly because it is hard, |
I wanted to be consistent with the latest scaffolder |
I got it. Looks Good. |
Feel free to leave a final review @suzuki-shunsuke :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Steps
see https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html
ctx
to all methodsValidateDiagFunc
continue with the upgrade guide and add new best practices for sdk v2-> will be done in refactor: do full internal refactoring #94move website to docs directory. uses-> will be done in refactor: do full internal refactoring #94index.md
Notes
ValidateDiagFunc
until feat: add example of usage of ValidateDiagFunc hashicorp/terraform-provider-scaffolding#47 is solved -> got solved. Will add it