-
Notifications
You must be signed in to change notification settings - Fork 47
Add cloudstack_project
resource
#167
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
base: main
Are you sure you want to change the base?
Conversation
I set this up for Cloudstack API 4.20, I see the tests are 4.18 and 4.19. What's the back version compatibility of this project looking for? There was a difference in the API between 4.18 and 4.19+ for this resource at a quick glance. So if there is a plan to add 4.20 Acceptance Tests and depreciate 4.18 I will wait for those results. |
Maybe supersedes #152 |
@CodeBleu If possible can you kick a test off here? I merged your actions changes from earlier today to hopefully get the acceptance tests actually working |
project
resource
project
resourcecloudstack_project
resource
Fix issue where getProjectByID() would always return "id not found" while getProjectByName() could find the same project. CloudStack projects are only unique within a domain context, so we now include domain ID in lookups. - Modified getProjectByID() to accept optional domain parameter - Updated all calls to include domain when available - Updated test functions accordingly - Updated documentation to clarify domain requirement for project imports
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.
Pull Request Overview
This PR adds a new cloudstack_project
resource to the Terraform CloudStack provider, enabling users to manage CloudStack projects through Terraform. The implementation includes comprehensive CRUD operations, import functionality, and account/user ownership management.
- Implements the
cloudstack_project
resource with full lifecycle support - Adds comprehensive test coverage for various project scenarios
- Includes proper documentation and website integration
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
cloudstack/resource_cloudstack_project.go |
Core resource implementation with CRUD operations and ownership management |
cloudstack/resource_cloudstack_project_test.go |
Comprehensive test suite covering basic operations, updates, imports, and edge cases |
cloudstack/provider.go |
Registers the new project resource in the provider |
cloudstack/resources.go |
Adds domain ID lookup support for project operations |
website/docs/r/project.html.markdown |
Complete documentation with examples and parameter descriptions |
website/cloudstack.erb |
Adds navigation link to project resource documentation |
scripts/list_accounts_and_users.go |
Utility script for listing accounts and users (development helper) |
README.md |
Minor formatting and container name corrections |
Comments suppressed due to low confidence (1)
cloudstack/resource_cloudstack_project_test.go:431
- The test configuration for userid testing doesn't actually include a userid parameter, making the test ineffective for validating userid functionality. The test should include a valid userid to properly test this feature.
const testAccCloudStackProject_userid = `
Co-authored-by: Copilot <[email protected]>
…e intended scope Co-authored-by: Copilot <[email protected]>
Adding
project
as a terraform managed resource option -> https://cloudstack.apache.org/api/apidocs-4.20/apis/createProject.htmlContributes to #82
Using this code for example: