Implementing-Terraform-on-Microsoft-Azure icon indicating copy to clipboard operation
Implementing-Terraform-on-Microsoft-Azure copied to clipboard

2-sec-vnet/main.tf - Cannot initialize end_date in azuread_service_principal_password resource

Open bluedog13 opened this issue 4 years ago • 0 comments

In the module : 2-sec-vnet/main.tf, line 114/115

value                = random_password.vnet_peering.result
end_date_relative    = "17520h"

gives the below error when I run "terraform validate".

Error: Unsupported argument

  • An argument named "end_date_relative" is not expected here.
  • Can't configure a value for "value": its value will be decided automatically based on the result of applying this configuration.

As an alternative, the below can be used

TERRAFORM CONFIG

time = {
      source  = "registry.terraform.io/hashicorp/time"
      version = "~> 0.7.2"
    }

RESOURCES

resource "time_rotating" "vnet_peering" {
  rotation_days = 7
}


resource "azuread_service_principal_password" "vnet_peering" {
  service_principal_id = azuread_service_principal.vnet_peering.id

  keepers = {
    rotation = time_rotating.vnet_peering.id
  }
}

bluedog13 avatar Aug 31 '21 06:08 bluedog13