This pull request includes significant updates to the Power Platform Terraform Provider, focusing on enhancing context management, improving logging, and updating build configurations.
Enhancements to Context Management and Logging:
internal/powerplatform/helpers/contexts.go: Introduced EnterRequestContext and EnterProviderContext functions to manage request and provider contexts, including logging the start and end of requests.
internal/powerplatform/api/request.go: Added BuildCorrelationHeaders and buildUserAgent methods to include context-specific headers and user agent strings in API requests. [1][2]
These changes collectively improve the maintainability, logging, and context management of the Power Platform Terraform Provider, ensuring better traceability and debugging capabilities.Published as a draft pr so that we can talk about design
This pull request includes significant updates to the Power Platform Terraform Provider, focusing on enhancing context management, improving logging, and updating build configurations.
Enhancements to Context Management and Logging:
internal/powerplatform/helpers/contexts.go
: IntroducedEnterRequestContext
andEnterProviderContext
functions to manage request and provider contexts, including logging the start and end of requests.internal/powerplatform/api/request.go
: AddedBuildCorrelationHeaders
andbuildUserAgent
methods to include context-specific headers and user agent strings in API requests. [1] [2]internal/powerplatform/services/environment/resource_environment.go
: Updated resource methods (Create
,Read
,Update
,Delete
,Configure
) to utilize the new context management functions for improved logging and context handling. (F65710a7L33R68, [1] [2] [3] [4] [5] [6]Build Configuration Updates:
.goreleaser.yml
: Updated theldflags
to include additional build information such asProviderVersion
,Commit
, andBranch
.common/release.go
: Added new variables (ProviderVersion
,Commit
,Branch
) to store build information, set during the build/release process.API Client Improvements:
internal/powerplatform/api/api_client.go
: ModifieddoRequest
method to acceptcontext.Context
as a parameter to support context-specific operations.Provider Metadata and Configuration Enhancements:
internal/powerplatform/provider/provider.go
: EnhancedMetadata
andConfigure
methods to log additional information and handle context better. AddedTerraformVersion
toProviderConfig
. [1] [2] [3] [4]Miscellaneous Changes:
.github/workflows/run_tests.yml
: Updated the path for test coverage artifacts totest-coverage.cov.html
.These changes collectively improve the maintainability, logging, and context management of the Power Platform Terraform Provider, ensuring better traceability and debugging capabilities.Published as a draft pr so that we can talk about design