authlete / terraform-provider-authlete

This is a terraform provider for managing Authlete configuration
https://www.authlete.com/
Mozilla Public License 2.0
5 stars 4 forks source link

`authlete_service` Resource Shows Unnecessary Changes in supported_scopes After Apply #163

Closed mnrtks closed 3 months ago

mnrtks commented 3 months ago

Hi there,

When using the authlete_service resource to manage an Authlete service, the supported_scopes attribute shows unnecessary changes after running terraform apply followed by terraform plan. This results in a recreation of the resource being detected even though there are no actual changes made to the resource. This issue specifically occurs when the name attribute of supported_scopes is set to "openid".

Terraform Version

Terraform v1.8.5
on darwin_arm64
+ provider registry.terraform.io/authlete/authlete v1.3.14

Affected Resource(s)

Terraform Configuration Files

terraform {
  required_providers {
    authlete = {
      source  = "authlete/authlete"
      version = "~> 1.3.14"
    }
  }
}

resource "authlete_service" "this" {
  issuer                   = "https://as.mydomain.com"
  service_name             = "MyDomainAS"
  description              = "A terraform based service for managing the Authlete based OAuth server"
  supported_grant_types    = ["AUTHORIZATION_CODE"]
  supported_response_types = ["CODE"]

  supported_scopes {
    name          = "openid"
    default_entry = false

    descriptions {
      tag   = "en"
      value = "A permission to request an OpenID Provider to issue an ID Token. See OpenID Connect Core 1.0, 3.1.2.1. for details."
    }
    descriptions {
      tag   = "ja"
      value = "OpenID プロバイダーに ID トークンの発行を要求するための権限です。詳細は OpenID Connect Core 1.0, 3.1.2.1. を参照してください。"
    }
  }
  scope_required = true
}

Expected Behavior

After running terraform apply, running terraform plan should show no changes if there have been no modifications to the configuration.

Actual Behavior

After running terraform apply, running terraform plan shows the following changes, indicating a recreation of the resource:

Terraform will perform the following actions:

  # module.authlete_service.authlete_service.this will be updated in-place
  ~ resource "authlete_service" "this" {
        id                                               = "978129159511"
        # (131 unchanged attributes hidden)

      - supported_scopes {
          - default_entry = false -> null
          - description   = "A permission to request an OpenID Provider to issue an ID Token. See OpenID Connect Core 1.0, 3.1.2.1. for details." -> null
          - name          = "openid" -> null

          - descriptions {
              - tag   = "en" -> null
              - value = "A permission to request an OpenID Provider to issue an ID Token. See OpenID Connect Core 1.0, 3.1.2.1. for details." -> null
            }
          - descriptions {
              - tag   = "ja" -> null
              - value = "OpenID プロバイダーに ID トークンの発行を要求するための権限です。詳細は OpenID Connect Core 1.0, 3.1.2.1. を参照してください。" -> null
            }
        }
      + supported_scopes {
          + default_entry = false
          + name          = "openid"
            # (1 unchanged attribute hidden)

          + descriptions {
              + tag   = "en"
              + value = "A permission to request an OpenID Provider to issue an ID Token. See OpenID Connect Core 1.0, 3.1.2.1. for details."
            }
          + descriptions {
              + tag   = "ja"
              + value = "OpenID プロバイダーに ID トークンの発行を要求するための権限です。詳細は OpenID Connect Core 1.0, 3.1.2.1. を参照してください。"
            }
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. Apply the provided Terraform configuration using terraform apply.
  2. Run terraform plan immediately after.
hefa commented 3 months ago

Thank you for the report, we will investigate it.

dcreado commented 3 months ago

@mnrtks can you try v1.3.15?

mnrtks commented 3 months ago

@dcreado This issue has been resolved. Thank you for fixing the issue!