-
Notifications
You must be signed in to change notification settings - Fork 30
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
Use terraform sdk v2 and support importing resources #51
Use terraform sdk v2 and support importing resources #51
Conversation
@lord-kyron could you take a look at this proposed change? |
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.
First of all, thank you for the work you have done!
Please delete the directory pkg. The binary files will be added to the release assets.
In some files need to fix indent. Please format go files with this command to fix indent:
gofmt -w plugin/providers/phpipam/*
It would be great to add an example of using terraform import
to the README.md file
id := d.Id() | ||
if len(id) > 0 { | ||
address_id, err := strconv.Atoi(id) | ||
if err != nil { | ||
return err | ||
} | ||
out[0], err = c.GetAddressByID(address_id) | ||
if err != nil { | ||
return err | ||
} | ||
} else { |
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 don't get the point of this change. Can you please add a comment why this check is needed?
id := d.Id() | ||
if len(id) > 0 { | ||
subnet_id, err := strconv.Atoi(id) | ||
if err != nil { | ||
return err | ||
} | ||
out[0], err = c.GetSubnetByID(subnet_id) | ||
if err != nil { | ||
return err | ||
} | ||
} else { |
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 don't get the point of this change. Can you please add a comment why this check is needed?
0f56b32
to
6aa23b8
Compare
Hi @pavel-z1, thanks for the review, I made the modifications you requested and explained why I needed to modify the import logic to ensure we don't destroy imported resources. |
6aa23b8
to
bf9d242
Compare
Hi @cristicalin ! Format please these files and I will merge PR
|
bf9d242
to
640222d
Compare
@pavel-z1 I |
Thank you @cristicalin ! |
This PR updates the provider to use the terraform v2 sdk and implements the ability to use
terraform import
to import pre-created resources from existing phpipam installations.Fixes: #49