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

azurerm_datadog_monitor_sso_configuration deprecate single_sign_on_enabled property #28520

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

wyattfry
Copy link
Collaborator

@wyattfry wyattfry commented Jan 15, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

  • Deprecates the single_sign_on_enabled property in favor of single_sign_on (a 4.0 TODO)

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • 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

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 & updated any relevent documentation.
  • 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.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

The unit tests have been skipped for a long time and fixing them is outside the scope of this PR.

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

This is a (please select all that apply):

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

Related Issue(s)

Relates to https://github.com/hashicorp/tf-azure-stratosphere/issues/245

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@wyattfry
Copy link
Collaborator Author

Unfortunately I have not yet found a Datadog API key, so I can't run the tests yet
image

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

Thanks for this @wyattfry. Datadog SSO stuff looks great as does removing the provider test stuff but unfortunately, some of the 4.0 removal stuff can't be done because it currently works in 4.0 and will break people if we remove it the way it's written

Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

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

spotted a couple extras to @mbfrahry's review

@wyattfry wyattfry changed the title Resolving 4.0 Resource TODOs Resolving 4.0 TODOs Datadog SSO Jan 16, 2025
@wyattfry
Copy link
Collaborator Author

I've discovered that i am able to make new datadog instances via azure portal (in azure terms, a "datadog monitor", not be confused with monitors within datadog), and do not need hashicorp to provision a datadog organization in order to test this resource.

To progress this work, whoever takes it, be it myself or anyone else, they should be able to progress with the self-serve datadog instances:

image

@wyattfry
Copy link
Collaborator Author

Closes this PR until I have a chance to focus on it.

@wyattfry wyattfry closed this Jan 28, 2025
@wyattfry wyattfry reopened this Feb 14, 2025
single_sign_on_enabled = "Enable"
enterprise_application_id = "XXXX"
single_sign_on = "Enable"
enterprise_application_id = "00000000-0000-0000-0000-000000000000"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because enterprise app IDs are always GUIDs, I felt it would be clearer to make the example value a GUID.

@wyattfry wyattfry marked this pull request as ready for review February 14, 2025 17:38
@wyattfry wyattfry requested a review from a team as a code owner February 14, 2025 17:38
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

Hey @wyattfry, I've left some comments on this review. Some of which are covered under the breaking-changes guide which I encourage you to look over

Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
// @tombuildsstuff: other options are available, but the Create handles this as a boolean for now
// should the field be a boolean? one to consider for 4.0 when this resource is inlined
string(singlesignon.SingleSignOnStatesEnable),
string(singlesignon.SingleSignOnStatesDisable),
Copy link
Member

Choose a reason for hiding this comment

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

Can you add support for the other values here as well? From what we saw, I doubt we'll need them but we may as well let people use them if they want


if !features.FivePointOh() {
resource.Schema["single_sign_on"].Required = false
resource.Schema["single_sign_on"].Optional = true
Copy link
Member

Choose a reason for hiding this comment

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

We'll want these to be computed as well since we're setting both into state even though the user will only specify one

Copy link
Member

Choose a reason for hiding this comment

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

Also, at this point, we could just have rewrite this with another block instead of changing the existing block

resource.Schema["single_sign_on"] = &pluginsdk.Schema{
...
}

resource.Schema["single_sign_on"].Optional = true
resource.Schema["single_sign_on_enabled"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
Copy link
Member

Choose a reason for hiding this comment

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

And computed here

},
}

if v, ok := d.GetOk("single_sign_on"); ok {
Copy link
Member

Choose a reason for hiding this comment

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

We should refactor this update method to use d.HasChanges so people can use ignore_changes if they want

@@ -50,7 +50,7 @@ The following arguments are supported:

* `datadog_monitor_id` - (Required) The Datadog Monitor Id which should be used for this Datadog Monitor SSO Configuration. Changing this forces a new Datadog Monitor SSO Configuration to be created.

* `single_sign_on_enabled` - (Required) The state of SingleSignOn configuration. Possible values are `Enable` and `Disable`.
* `single_sign_on` - (Required) The state of SingleSignOn configuration. Possible values are `Enable`, `Disable`.
Copy link
Member

Choose a reason for hiding this comment

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

You'll also want to add a note in the 5.0 upgrade guide

@@ -64,7 +64,6 @@ func TestAccDatadogMonitorSSO_requiresImport(t *testing.T) {
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("single_sign_on_enabled").HasValue("Enable"),
Copy link
Member

Choose a reason for hiding this comment

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

We'll want to update the tests to use the new value and keep a legacy test config around

@wyattfry wyattfry marked this pull request as draft February 17, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants