hashicorp / terraform-provider-azuread

Terraform provider for Azure Active Directory
https://registry.terraform.io/providers/hashicorp/azuread/latest/docs
Mozilla Public License 2.0
415 stars 280 forks source link

azuread_application_password.end_date_relative is ignored #1424

Open mhyllander opened 4 days ago

mhyllander commented 4 days ago

Community Note

Terraform (and AzureAD Provider) Version

Terraform v1.8.5 on linux_amd64

Affected Resource(s)

Terraform Configuration Files

resource "azuread_application_password" "app" {
  application_id    = azuread_application.app.id
  display_name      = "service connection"
  end_date_relative = "9504h" # 13 months
  rotate_when_changed = {
    rotation = time_rotating.rotation_period.id
  }
}

Debug Output

Panic Output

Expected Behavior

The rotated password should have been created with an expiration date of 13 months.

Actual Behavior

The rotated password was created with an expiration date of 24 months.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

applicationPasswordResourceCreate calls PasswordCredentialForResource, which parses end_date_relative, then calls PasswordCredential, which doesn't use end_date_relative, resulting in a default end_date of 24 months.

Compare with the end date calculations done in KeyCredentialForResource.

mhyllander commented 4 days ago

This appears to be a regression caused by https://github.com/hashicorp/terraform-provider-azuread/pull/1389.