Skip to content
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

powerplatform_tenant_isolation_policy resource #618

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

mattdot
Copy link
Member

@mattdot mattdot commented Mar 5, 2025

This pull request introduces a new tenant_isolation_policy resource to enforce tenant isolation settings, along with various other improvements and additions. The most important changes include the addition of new resource documentation, updates to the testing and development environment configurations, and the implementation of the necessary API client and models for the new resource.

New Resource Addition:

  • Added new tenant_isolation_policy resource to enforce tenant isolation settings. This includes the creation of the necessary API client, models, and resource schema. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Documentation:

  • Added comprehensive instructions for the Terraform Provider Power Platform, covering compilation, linting, testing, and best practices.
  • Added new documentation for the tenant_isolation_policy resource, including example usage and schema details.

Testing and Development Environment:

  • Updated .devcontainer/devcontainer.json to include the GitHub.copilot-chat extension.
  • Added a new launch configuration for attaching to a process in .vscode/launch.json. [1] [2]
  • Added testing guidance to ensure proper organization and execution of unit and acceptance tests.

Linter Configuration:

  • Updated .golangci.yml to allow for a higher number of issues per linter and the same issues, increasing the limits from 1 to 10.This pull request includes several changes, primarily focusing on adding support for tenant isolation policies, updating development configurations, and improving documentation. The most important changes are summarized below:

Tenant Isolation Policy Support:

  • Added a new resource powerplatform_tenant_isolation_policy to manage tenant isolation policies. This includes the necessary API client, DTOs, and resource models. [1] [2] [3] [4]

Documentation:

  • Added detailed instructions for development tasks in .github/copilot-instructions.md, including commands for compiling code, running linters, and executing tests.
  • Created a new documentation file for the powerplatform_tenant_isolation_policy resource in docs/resources/tenant_isolation_policy.md.

Development Configuration:

  • Updated .devcontainer/devcontainer.json to include the GitHub.copilot-chat extension.
  • Modified .vscode/launch.json to add a new configuration for attaching to a process and to use the integrated terminal for debugging. [1] [2]

Linter Settings:

  • Increased the maximum number of issues per linter and the maximum number of the same issues in .golangci.yml.

Examples:

  • Added example configurations for the powerplatform_tenant_isolation_policy resource in examples/resources/powerplatform_tenant_isolation_policy/resource.tf and examples/tenant-isolation/main.tf. [1] [2]

github-actions[bot] added 2 commits March 5, 2025 10:04

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@mattdot mattdot self-assigned this Mar 5, 2025
@mattdot mattdot linked an issue Mar 5, 2025 that may be closed by this pull request
10 tasks
@mattdot mattdot requested a review from Copilot March 5, 2025 23:54

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

Adds support for the new powerplatform_tenant_isolation_policy resource while also improving related documentation, development configurations, and linter settings.

  • Introduces API client, DTOs, and models to enable management of tenant isolation policies.
  • Provides detailed documentation and example usage for the new resource.
  • Updates development configuration files and test registration to include the new resource, and increases linter thresholds.

Reviewed Changes

File Description
docs/resources/tenant_isolation_policy.md Added documentation, example usage, and schema details for the tenant isolation policy resource.
internal/services/tenant_isolation_policy/api_tenant_isolation_policy.go Introduces the API client with methods to get and create/update tenant isolation policies, including async polling.
internal/services/tenant_isolation_policy/dto.go Defines the DTOs for tenant isolation policy, including nested properties for allowed tenants.
internal/services/tenant_isolation_policy/models.go Provides the Terraform resource model for tenant isolation policies.
.github/copilot-instructions.md Updates instructions for building, testing, and linting, ensuring developers have clear guidelines.
.golangci.yml Increases linter thresholds, adjusting the maximum issues reported per linter.
internal/provider/provider.go Registers the new tenant isolation policy resource and updates provider resources accordingly.
internal/provider/provider_test.go Updates tests to verify that the new tenant isolation policy resource is correctly registered.

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

internal/services/tenant_isolation_policy/api_tenant_isolation_policy.go:116

  • Consider adding unit tests to specifically cover the async polling logic and error paths in DoWaitForLifecycleOperationStatus to ensure it behaves correctly under different HTTP status responses and header values.
func (client *Client) DoWaitForLifecycleOperationStatus(ctx context.Context, response *api.Response) (*TenantIsolationPolicyDto, error) {
@mattdot mattdot marked this pull request as ready for review March 6, 2025 04:46
@mattdot mattdot added the ai assisted Pull requests that have be fully or partially implemented using Copilot or AI label Mar 6, 2025

if resp.HttpResponse.StatusCode == http.StatusAccepted {
// Handle async operation
_, err := client.DoWaitForLifecycleOperationStatus(ctx, resp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add retry logic here, I have example on #622

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this is relevant to this particular operation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you don't want to have a retry here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already has retry logic because it uses execute which does retries. I don't know why 622 isn't using the standard retry logic.

@mattdot mattdot requested a review from mawasile March 8, 2025 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai assisted Pull requests that have be fully or partially implemented using Copilot or AI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

powerplatform_tenant_isolation_policy resource
3 participants