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"
}
]
})
}