Skip to content

Unnecessary requirement for project in resources#280

Open
bhouse-nexthop wants to merge 5 commits intoapache:mainfrom
bhouse-nexthop:resolve-project
Open

Unnecessary requirement for project in resources#280
bhouse-nexthop wants to merge 5 commits intoapache:mainfrom
bhouse-nexthop:resolve-project

Conversation

@bhouse-nexthop
Copy link

project can be learned/inherited based on the other parameters specified. The cloudstack provider was mandating project in instances where the actual cloudstack api does not require, such as on cloudstack_port_forward.

This adds proper inheritance making the project completely optional in a lot of cases. You can't create an network in a different project than its associated vpc, likewise you can't create a network acl in a different project than the vpc, so you shouldn't have to specify it.

In some instances like cloudstack_port_forward and cloudstack_network_acl the project probably should be removed completely from the schema as it serves zero actual purpose, but I chose to preserve compatibility with existing users instead.

Fixes #278

  • Ended up being "project" wasn't specified.

…it from ip address

Support both explicit project specification and automatic inheritance from IP address:
- Port forward inherits project from ip_address_id when no explicit project is set
- Uses projectid=-1 for universal IP address lookup across projects
- Updates state with inherited or explicit project during read operations
- Schema updated to mark project as Optional and Computed
- Maintains backward compatibility with existing implementations

Changes:
- Added Computed: true to project field
- Modified resourceCloudStackPortForwardCreate to fetch IP address and inherit project
- Modified resourceCloudStackPortForwardRead to handle universal project search
- Added TestAccCloudStackPortForward_projectInheritance test case
- Updated documentation with inheritance behavior and example

All 4 port forward acceptance tests passing.
When creating a network in a VPC, if no explicit project is specified,
the network will now automatically inherit the project from the VPC.

This simplifies configuration by eliminating the need to specify the
project parameter when creating networks in VPCs that belong to projects.

Changes:
- Modified resourceCloudStackNetworkCreate to fetch VPC details and
  inherit projectid when vpc_id is provided but project is not
- Modified resourceCloudStackNetworkRead to handle networks with
  inherited projects by trying projectid=-1 when no explicit project
  is set
- Added TestAccCloudStackNetwork_vpcProjectInheritance test case
- Updated documentation with inheritance behavior and example

All 14 network acceptance tests pass.
…network

Implement automatic project inheritance for cloudstack_instance resource:
- Instance inherits project from network_id when no explicit project is set
- Only applies to Advanced networking zones
- Uses projectid=-1 for universal network lookup across projects
- Updates state with inherited project during read operations

Changes:
- Modified resourceCloudStackInstanceCreate to fetch network and inherit project
- Modified resourceCloudStackInstanceRead to set project in state
- Added TestAccCloudStackInstance_networkProjectInheritance test case
- Updated documentation with inheritance behavior and example

All 12 instance acceptance tests passing.
… VPC or network

Implement automatic project inheritance for cloudstack_ipaddress resource:
- IP address inherits project from vpc_id when no explicit project is set
- IP address inherits project from network_id when no explicit project is set
- Uses projectid=-1 for universal VPC/network lookup across projects
- Updates state with inherited project during read operations

Changes:
- Modified resourceCloudStackIPAddressCreate to fetch VPC/network and inherit project
- Modified resourceCloudStackIPAddressRead to handle universal project search
- Added TestAccCloudStackIPAddress_vpcProjectInheritance test case
- Added TestAccCloudStackIPAddress_networkProjectInheritance test case
- Updated documentation with inheritance behavior and examples

All 5 IP address acceptance tests passing.
…om VPC

Implement automatic project inheritance for cloudstack_network_acl resource:
- Network ACL inherits project from vpc_id when no explicit project is set
- Uses projectid=-1 for universal VPC lookup across projects
- Updates state with inherited project during read operations
- Schema updated to mark project as Computed

Changes:
- Modified resourceCloudStackNetworkACLCreate to fetch VPC and inherit project
- Modified resourceCloudStackNetworkACLRead to handle universal project search
- Updated schema to mark project as Computed: true
- Added TestAccCloudStackNetworkACL_vpcProjectInheritance test case
- Updated documentation with inheritance behavior and example

All 5 network ACL acceptance tests passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloudstack_port_forward always returns error (but really succeeds)

1 participant