Skip to content

Commit

Permalink
Merge branch 'main' into feature/storage-aad-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Mar 14, 2024
2 parents 3d4058d + b54f052 commit ccdb7fa
Show file tree
Hide file tree
Showing 74 changed files with 4,253 additions and 1,239 deletions.
76 changes: 76 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!-- All Submissions -->


## Community Note
<!-- Please leave the community note as is. -->
* Please vote on this PR by adding a :thumbsup: [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original PR to help the community and maintainers prioritize for review
* Please do not leave "+1" or "me too" comments, they generate extra noise for PR followers and do not help prioritize for review


## PR Checklist

- [ ] I have followed the guidelines in our [Contributing Documentation](../blob/main/contributing/README.md).
- [ ] I have checked to ensure there aren't other open [Pull Requests](../pulls) for the same update/change.
- [ ] I have checked if my changes close any open issues. If so please include appropriate [closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) below.
- [ ] I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
For example: “`resource_name_here` - description of change e.g. adding property `new_property_name_here`



<!-- You can erase any parts of this template below this point that are not applicable to your Pull Request. -->


## New Feature Submissions

- [ ] My submission includes Test coverage as described in the [Contribution Guide](../blob/main/contributing/topics/guide-new-resource.md) and the tests pass. (if this is not possible for any reason, please include details of why below)


## Changes to existing Resource / Data Source

- [ ] I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
- [ ] I have written new tests for my resource or datasource changes.
- [ ] I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
- [ ] (For changes that include a **state migration only**). I have manually tested the migration path between relevant versions of the provider.


## Documentation Changes

- [ ] Documentation is written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.


## Description

<!-- Please include a description below with the reason for the PR, what it is doing, what it is trying to accomplish, and anything relevant for a reviewer to know.
If this is a breaking change for users please detail how it cannot be avoided and why it should be made in a minor version of the provider -->

## Testing Logs/Evidence

<!-- Please include your testing evidence here or an explanation on why no testing evidence can be provided.
For state migrations please test the changes locally and provide details here, such as the versions involved in testing the migration path. For further details on testing state migration changes please see our guide on [state migrations](https://github.com/hashicorp/terraform-provider-azurerm/blob/main/contributing/topics/guide-state-migrations.md#testing) in the contributor documentation. -->

## Related Issue(s)
Fixes #0000

## Change Log
Below please provide what should go into the changelog (if anything) conforming to the [Changelog Format documented here](../blob/main/contributing/topics/maintainer-changelog.md).

<!-- Replace the changelog example below with your entry. One resource per line. -->

* `azurerm_resource` - support for the `thing1` property [GH-00000]


<!-- What type of PR is this? -->
This is a (please select all that apply):

- [ ] Bug Fix
- [ ] New Feature (ie adding a service, resource, or data source)
- [ ] Enhancement
- [ ] Breaking Change



> [!NOTE]
> If this PR changes meaningfully during the course of review please update the title and description as required.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ENHANCEMENTS:

* dependencies: updating to `v1.33.0` of `google.golang.org/protobuf` [GH-25243]
* `azurerm_kusto_cluster` - support `None` pattern for the `virtual_network_configuration` block [GH-24733]
* `azurerm_linux_function_app` - support for the Node `20` runtime [GH-24073]
* `azurerm_linux_function_app_slot` - support for the Node `20` runtime [GH-24073]
Expand All @@ -15,6 +16,7 @@ BUG FIXES:
* `azurerm_container_app_custom_domain` - fix resource ID parsing bug preventing import [GH-25192]
* `azurerm_windows_web_app` - fix incorrect warning message when checking name availability [GH-25214]
* `azurerm_virtual_machine_run_command` - prevent a bug during updates [GH-25186]
* Data Source: `azurerm_storage_table_entities` - Fix `items.x.properties` truncating to one entry [GH-25211]

## 3.95.0 (March 08, 2024)

Expand Down
69 changes: 62 additions & 7 deletions contributing/topics/guide-opening-a-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ As a general rule, the smaller the PR the quicker it's merged - as such when upg

We also recommend not opening a PR based on your `main` branch. By doing this any changed pushed to the PR may inadvertently be also pushed to your `main` branch without warning.

Due to the high volume of PR's on the project and to ensure maintainers are able to focus on changes which are ready to review, please do not open Draft PRs or work that is not yet ready to be reviewed.
Due to the high volume of PRs on the project and to ensure maintainers are able to focus on changes which are ready to review, please do not open Draft PRs or work that is not yet ready to be reviewed.

## Process

Pull Requests generally go through a number of phrases which vary slightly depending on what's being changed.
Pull Requests generally go through a number of phases which vary slightly depending on what's being changed.

The following guides cover the more common scenarios we see:

Expand All @@ -46,7 +46,7 @@ In general, Pull Requests which add/change either code or SDK's go through the f
* Don't send the PR from your `main` branch.
* The PR Title is obvious/clear about what it's changing (see `Title` below).
* The PR Body contains a summary of what/why is included (see `Body` below).
* any linked Issues
* any linked Issues (see `Body` below)

### Title

Expand All @@ -73,12 +73,67 @@ Examples of poorly written PR titles:
- `add cosmos property`
- `support encryption, local_authentication_enabled properties`

### Description
### Body

A PR should include a brief description of the reason for the PR, what it is doing, what it is trying to accomplish, and anything relevant for a reviewer to know. It also helps to paste the output from running the accpetance tests.
An example of our PR template is shown below.

It should also link to any related issues/PRs and include the following for any issues that it will resolve:
#### Community Note
<!-- Please leave the community note as is. -->

* Please vote on this PR by adding a :thumbsup: [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original PR to help the community and maintainers prioritize for review
* Please do not leave "+1" or "me too" comments, they generate extra noise for PR followers and do not help prioritize for review

#### PR Checklist

- [ ] Have you followed the guidelines in our [Contributing Documentation](../contributing/README.md)?
- [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?
- [ ] Have you used a meaningful PR description to help maintainers and other users understand this change and help prevent duplicate work?
Example:
`resource_name_here` - description of change e.g. adding property `new_property_name_here`
- [ ] Do your changes close any open issues? If so please include appropriate [closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) below.

<!-- You can erase any parts of this template below this point that are not applicable to your Pull Request. -->

#### New Feature Submissions

- [ ] Does your submission include Test coverage as described in the [Contribution Guide](../contributing/topics/guide-new-resource.md) and the tests pass? (if this is not possible for any reason, please include details of why below)

#### Changes to existing Resource / Data Source

- [ ] Have you added an explanation of what your changes do and why you'd like us to include them? (This may be covered by linking to an issue above, but may benefit from additional explanation)
- [ ] Have you written new tests for your resource or datasource changes?
- [ ] Have you successfully run tests with your changes locally? If not, please provide details on testing challenges that prevented you running the tests.

#### Documentation Changes

- [ ] Documentation is written in International English.
- [ ] Documentation is written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.

#### Description

<!-- Please include a description below with the reason for the PR, what it is doing, what it is trying to accomplish, and anything relevant for a reviewer to know. It also helps to paste the output from running the acceptance tests. -->


#### Related Issue(s)
Use [linking keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) here like "fixes", "closes", "resolves", etc:
```
fixes #1234,#5678
Fixes #1234, fixes #5678, fixes #9101
```
#### Change Log

[Changelog Format](https://github.com/hashicorp/terraform-provider-azurerm/blob/main/contributing/topics/maintainer-changelog.md)

<!-- Replace the changelog example below with your entry. One resource per line. -->

* `azurerm_resource` - support for the `thing1` property [GH-00000]

<!-- What type of PR is this? -->

- [ ] Bug Fix
- [ ] New Feature


> [!NOTE] If this PR changes meaningfully during the course of review please update the title and description as required.


2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ require (
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
software.sslmate.com/src/go-pkcs12 v0.4.0 // indirect
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func SiteConfigSchemaWindowsFunctionAppSlot() *pluginsdk.Schema {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
Description: "Should the Windows Web App use a 32-bit worker.",
Description: "Should the Windows Function App use a 32-bit worker.",
},

"websockets_enabled": {
Expand Down
58 changes: 51 additions & 7 deletions internal/services/azurestackhci/stack_hci_cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2023-08-01/clusters"
Expand All @@ -35,13 +36,17 @@ func (r StackHCIClusterDataSource) ModelObject() interface{} {
}

type StackHCIClusterDataSourceModel struct {
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
Location string `tfschema:"location"`
ClientId string `tfschema:"client_id"`
TenantId string `tfschema:"tenant_id"`
AutomanageConfigurationId string `tfschema:"automanage_configuration_id"`
Tags map[string]interface{} `tfschema:"tags"`
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
Location string `tfschema:"location"`
ClientId string `tfschema:"client_id"`
TenantId string `tfschema:"tenant_id"`
AutomanageConfigurationId string `tfschema:"automanage_configuration_id"`
CloudId string `tfschema:"cloud_id"`
ServiceEndpoint string `tfschema:"service_endpoint"`
ResourceProviderObjectId string `tfschema:"resource_provider_object_id"`
Identity []identity.ModelSystemAssigned `tfschema:"identity"`
Tags map[string]interface{} `tfschema:"tags"`
}

func (r StackHCIClusterDataSource) Arguments() map[string]*schema.Schema {
Expand Down Expand Up @@ -75,6 +80,23 @@ func (r StackHCIClusterDataSource) Attributes() map[string]*schema.Schema {
Computed: true,
},

"cloud_id": {
Type: pluginsdk.TypeString,
Computed: true,
},

"service_endpoint": {
Type: pluginsdk.TypeString,
Computed: true,
},

"resource_provider_object_id": {
Type: pluginsdk.TypeString,
Computed: true,
},

"identity": commonschema.SystemAssignedIdentityComputed(),

"tags": commonschema.TagsDataSource(),
}
}
Expand Down Expand Up @@ -108,6 +130,10 @@ func (r StackHCIClusterDataSource) Read() sdk.ResourceFunc {

if props := model.Properties; props != nil {
cluster.ClientId = pointer.From(props.AadClientId)
cluster.CloudId = pointer.From(props.CloudId)
cluster.Identity = flattenSystemAssignedToModel(model.Identity)
cluster.ResourceProviderObjectId = pointer.From(props.ResourceProviderObjectId)
cluster.ServiceEndpoint = pointer.From(props.ServiceEndpoint)
cluster.TenantId = pointer.From(props.AadTenantId)

assignmentResp, err := hciAssignmentClient.Get(ctx, id.ResourceGroupName, id.ClusterName, "default")
Expand All @@ -132,3 +158,21 @@ func (r StackHCIClusterDataSource) Read() sdk.ResourceFunc {
},
}
}

func flattenSystemAssignedToModel(input *identity.SystemAndUserAssignedMap) []identity.ModelSystemAssigned {
if input == nil {
return []identity.ModelSystemAssigned{}
}

if input.Type == identity.TypeNone {
return []identity.ModelSystemAssigned{}
}

return []identity.ModelSystemAssigned{
{
Type: input.Type,
PrincipalId: input.PrincipalId,
TenantId: input.TenantId,
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ func TestAccStackHCIClusterDataSource_basic(t *testing.T) {
check.That(data.ResourceName).Key("location").IsNotEmpty(),
check.That(data.ResourceName).Key("client_id").IsNotEmpty(),
check.That(data.ResourceName).Key("tenant_id").IsNotEmpty(),
check.That(data.ResourceName).Key("cloud_id").IsNotEmpty(),
check.That(data.ResourceName).Key("service_endpoint").IsNotEmpty(),
check.That(data.ResourceName).Key("resource_provider_object_id").IsNotEmpty(),
),
},
})
}

func TestAccStackHCIClusterDataSource_identity(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_stack_hci_cluster", "test")
r := StackHCIClusterDataSource{}

data.DataSourceTest(t, []acceptance.TestStep{
{
Config: r.identity(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("identity.0.type").HasValue("SystemAssigned"),
check.That(data.ResourceName).Key("identity.0.principal_id").IsNotEmpty(),
check.That(data.ResourceName).Key("identity.0.tenant_id").IsNotEmpty(),
),
},
})
Expand All @@ -39,3 +58,14 @@ data "azurerm_stack_hci_cluster" "test" {
}
`, StackHCIClusterResource{}.basic(data))
}

func (d StackHCIClusterDataSource) identity(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
data "azurerm_stack_hci_cluster" "test" {
name = azurerm_stack_hci_cluster.test.name
resource_group_name = azurerm_stack_hci_cluster.test.resource_group_name
}
`, StackHCIClusterResource{}.systemAssignedIdentity(data))
}
Loading

0 comments on commit ccdb7fa

Please sign in to comment.