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

Add support for the Azure credentials resource #1907

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

Conversation

andriikushch
Copy link

@andriikushch andriikushch commented Nov 14, 2024

This PR introduces the grafana_cloud_provider_azure_credential resource and data source to the Grafana Terraform provider. The new resource allows users to manage Azure credentials within their Grafana Cloud stack. The data source enables users to retrieve information about existing Azure credentials.

Copy link

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically.
To do so, a Grafana Labs employee must trigger the cloud acceptance tests workflow manually.

@andriikushch andriikushch force-pushed the andrii/azure-credentials branch from fac0780 to 184378c Compare November 15, 2024 09:42
@andriikushch andriikushch marked this pull request as ready for review November 15, 2024 09:58
@andriikushch andriikushch requested review from a team as code owners November 15, 2024 09:58
StackID types.String `tfsdk:"stack_id"`
ClientSecret types.String `tfsdk:"client_secret"`
ResourceID types.String `tfsdk:"resource_id"`
ResourceTagFilters []TagFilter `tfsdk:"resource_tag_filter"`
Copy link
Contributor

@tristanburgess tristanburgess Nov 26, 2024

Choose a reason for hiding this comment

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

I've recently found out that if we use Go slice types directly here, instead of the Terraform type e.g. List, you can get errors when a value is planned by Terraform with a state other than the normal state e.g. Unknown. See https://github.com/grafana/cloud-onboarding/issues/8084. I'm still working through what the right pattern is myself, possibly handing off to @thepalbi on Wednesday, but this will need to be fixed here as well.

stack_id = grafana_cloud_provider_azure_credential.test.stack_id
resource_id = grafana_cloud_provider_azure_credential.test.resource_id

resource_discovery_tag_filter {
Copy link
Contributor

@tristanburgess tristanburgess Dec 13, 2024

Choose a reason for hiding this comment

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

does this + the docs need to be updated to remove these blocks from the data source example?

Copy link
Author

Choose a reason for hiding this comment

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

Removed 👍

},
},
Blocks: map[string]schema.Block{
"resource_discovery_tag_filter": schema.ListNestedBlock{
Copy link
Contributor

@tristanburgess tristanburgess Dec 13, 2024

Choose a reason for hiding this comment

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

are these filters required to look up a unique resource? I would think that just the stack and resource ID are sufficient, because it looks like the client GetAzureCredential function only needs the stack ID and resource ID. I think the inner fields need to be marked with Computed instead of Required, see e.g.

Copy link
Contributor

@tristanburgess tristanburgess Dec 13, 2024

Choose a reason for hiding this comment

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

if so, then it looks like resource_discovery_tag_filter needs to be retrieved and set below in the Read function from the API response as well

Copy link
Author

Choose a reason for hiding this comment

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

Done

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.

3 participants