-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/cloudstack: add project support for CloudStack Instances #2115
Conversation
@jalemieux I just merged PR xanzy/go-cloudstack#21 so we're good to move forward with this one. I'll do a review in just a bit, but noticed you only added a parameter Otherwise when you create a VPC/network and want to create an instance in there, it will not be possible as the VPC/network will not be part of the project. Not sure how CS will handle that, but I would assume that you would want all needed resources to be created within the same project right? But no need to do everything at once of course, so we can just start with this first resource... |
@@ -82,6 +82,11 @@ func resourceCloudStackInstance() *schema.Resource { | |||
Optional: true, | |||
Default: false, | |||
}, | |||
"project_name": &schema.Schema{ |
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.
Just a small nit, please add an empty line between parameter declarations and I would prefer to keep the name a little shorter to just project
...
@jalemieux please see the inline comments for some pointers and suggestions. Also I'm missing a line like So there's still some work to do before we can merge this in, but I really like to direction you are going by adding project support to the CloudStack provider. So thanks for opening the PR and let's make sure we get this feature in! |
@svanharmelen thanks for the feedback! |
@jalemieux nice updates, looks good! Think we should probably add a test for this as well (or extend one of the existing tests). What happens (or should happen) if TF notices a configuration option is no longer set, is that it will check the new config against your (refreshed) state and if there is a diff it should (when running So in this case if the instance in member of a project and you remove the project attribute from your config, I think it should notice that and recreate the instance outside a project... |
@svanharmelen thanks, I will work on the tests. Regarding the removal of
However, applying the plan doesn't seem to have any effect. After applying, rerunning plan will produce the same output:
I figured other providers must run into similar corner cases. There ought to be something that in TF looks for removed attributes and recreate resources if necessary. Or something in the attribute schema itself, that, like |
Thanks for the clear explanation. I'll have a closer look at this one to see if I can see why this happens. |
@svanharmelen i added a test for create instance with a project's name and project's id. I tested the former here, but can't test the latter. Worked well with project name. |
CLOUDSTACK_NETWORK_1, | ||
CLOUDSTACK_TEMPLATE, | ||
CLOUDSTACK_ZONE, | ||
CLOUDSTACK_PROJECT_id) |
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.
Typo breaking Travis...
@svanharmelen please review. Tested both cases. |
LGTM! |
provider/cloudstack: add project support for CloudStack Instances
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Add the ability to specify the project an instance should belong to. This is contingent on https://github.com/xanzy/go-cloudstack/pull/21/files getting merged.