Terraform resource for managing an AWS Transcribe LanguageModel.
data "aws_iam_policy_document" "example" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["transcribe.amazonaws.com"]
}
}
}
resource "aws_iam_role" "example" {
name = "example"
assume_role_policy = data.aws_iam_policy_document.example.json
}
resource "aws_iam_role_policy" "test_policy" {
name = "example"
role = aws_iam_role.example.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"s3:GetObject",
"s3:ListBucket",
]
Effect = "Allow"
Resource = ["*"]
},
]
})
}
resource "aws_s3_bucket" "example" {
bucket = "example-transcribe"
force_destroy = true
}
resource "aws_s3_object" "object" {
bucket = aws_s3_bucket.example.id
key = "transcribe/test1.txt"
source = "test1.txt"
}
resource "aws_transcribe_language_model" "example" {
model_name = "example"
base_model_name = "NarrowBand"
input_data_config {
data_access_role_arn = aws_iam_role.example.arn
s3_uri = "s3://${aws_s3_bucket.example.id}/transcribe/"
}
language_code = "en-US"
tags = {
ENVIRONMENT = "development"
}
}
The following arguments are required:
base_model_name
- (Required) Name of reference base model.input_data_config
- (Required) The input data config for the LanguageModel. See Input Data Config for more details.language_code
- (Required) The language code you selected for your language model. Refer to the supported languages page for accepted codes.model_name
- (Required) The model name.data_access_role_arn
- (Required) IAM role with access to S3 bucket.s3_uri
- (Required) S3 URI where training data is located.tuning_data_s3_uri
- (Optional) S3 URI where tuning data is located.The following arguments are optional:
tags
- (Optional) A map of tags to assign to the LanguageModel. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.This resource exports the following attributes in addition to the arguments above:
id
- LanguageModel name.arn
- ARN of the LanguageModel.create
- (Default 600m
)In Terraform v1.5.0 and later, use an import
block to import Transcribe LanguageModel using the model_name
. For example:
import {
to = aws_transcribe_language_model.example
id = "example-name"
}
Using terraform import
, import Transcribe LanguageModel using the model_name
. For example:
% terraform import aws_transcribe_language_model.example example-name