Is it possible to extend terraform resource with new attributes?

I want to add some extra attributes to a resource in Terraform, do terraform support that? either by implementing other custom providers or any other way.

These additional attributes should be visible as part of terraform plan and apply JSON output also.

For eg:

resource "aws_iam_role" "jenkins_role" {
  name = var.role_name

  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Principal = {
          Service = "ec2.amazonaws.com"
        }
        Action = "sts:AssumeRole"
      }
    ]
  })
}

this is my IAM role resource and I want to add 2 more attributes like “resourceDisplayName and resourceDescription” to all resource block. something like below:

resource "aws_iam_role" "jenkins_role" {
  name = var.role_name

  resourceDisplayName = "Create a new jenkin role"
 resourceDescription = "This will create a new jenkin role which will be used for ..."

  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Principal = {
          Service = "ec2.amazonaws.com"
        }
        Action = "sts:AssumeRole"
      }
    ]
  })
}

Hi @manishjain5238,

The configuration schema for each resource type is entirely under the control of the provider that defines the resource type. There is no way to extend it except to create your own fork of the provider with the schemas modified to include the new information you want to include and the logic for handling those new arguments.

Thanks @apparentlymart for the response.