Provides an FIS Experiment Template, which can be used to run an experiment. An experiment template contains one or more actions to run on specified targets during an experiment. It also contains the stop conditions that prevent the experiment from going out of bounds. See Amazon Fault Injection Simulator for more information.
resource "aws_fis_experiment_template" "example" {
description = "example"
role_arn = aws_iam_role.example.arn
stop_condition {
source = "none"
}
action {
name = "example-action"
action_id = "aws:ec2:terminate-instances"
target {
key = "Instances"
value = "example-target"
}
}
target {
name = "example-target"
resource_type = "aws:ec2:instance"
selection_mode = "COUNT(1)"
resource_tag {
key = "env"
value = "example"
}
}
}
The following arguments are required:
action
- (Required) Action to be performed during an experiment. See below.description
- (Required) Description for the experiment template.role_arn
- (Required) ARN of an IAM role that grants the AWS FIS service permission to perform service actions on your behalf.stop_condition
- (Required) When an ongoing experiment should be stopped. See below.The following arguments are optional:
tags
- (Optional) Key-value mapping of tags. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.target
- (Optional) Target of an action. See below.log_configuration
- (Optional) The configuration for experiment logging. See below.action
action_id
- (Required) ID of the action. To find out what actions are supported see AWS FIS actions reference.name
- (Required) Friendly name of the action.description
- (Optional) Description of the action.parameter
- (Optional) Parameter(s) for the action, if applicable. See below.start_after
- (Optional) Set of action names that must complete before this action can be executed.target
- (Optional) Action's target, if applicable. See below.parameter
key
- (Required) Parameter name.value
- (Required) Parameter value.For a list of parameters supported by each action, see AWS FIS actions reference.
target
(action.*.target
)key
- (Required) Target type. Valid values are AutoScalingGroups
(EC2 Auto Scaling groups), Buckets
(S3 Buckets), Cluster
(EKS Cluster), Clusters
(ECS Clusters), DBInstances
(RDS DB Instances), Instances
(EC2 Instances), Nodegroups
(EKS Node groups), Pods
(EKS Pods), ReplicationGroups
(ElastiCache Redis Replication Groups), Roles
(IAM Roles), SpotInstances
(EC2 Spot Instances), Subnets
(VPC Subnets), Tables
(DynamoDB encrypted global tables), Tasks
(ECS Tasks), TransitGateways
(Transit gateways), Volumes
(EBS Volumes). See the documentation for more details.value
- (Required) Target name, referencing a corresponding target.stop_condition
source
- (Required) Source of the condition. One of none
, aws:cloudwatch:alarm
.value
- (Optional) ARN of the CloudWatch alarm. Required if the source is a CloudWatch alarm.target
name
- (Required) Friendly name given to the target.resource_type
- (Required) AWS resource type. The resource type must be supported for the specified action. To find out what resource types are supported, see Targets for AWS FIS.selection_mode
- (Required) Scopes the identified resources. Valid values are ALL
(all identified resources), COUNT(n)
(randomly select n
of the identified resources), PERCENT(n)
(randomly select n
percent of the identified resources).filter
- (Optional) Filter(s) for the target. Filters can be used to select resources based on specific attributes returned by the respective describe action of the resource type. For more information, see Targets for AWS FIS. See below.resource_arns
- (Optional) Set of ARNs of the resources to target with an action. Conflicts with resource_tag
.resource_tag
- (Optional) Tag(s) the resources need to have to be considered a valid target for an action. Conflicts with resource_arns
. See below.parameters
- (Optional) The resource type parameters.filter
path
- (Required) Attribute path for the filter.values
- (Required) Set of attribute values for the filter.resource_tag
key
- (Required) Tag key.value
- (Required) Tag value.log_configuration
log_schema_version
- (Required) The schema version. See documentation for the list of schema versions.cloudwatch_logs_configuration
- (Optional) The configuration for experiment logging to Amazon CloudWatch Logs. See below.s3_configuration
- (Optional) The configuration for experiment logging to Amazon S3. See below.cloudwatch_logs_configuration
log_group_arn
- (Required) The Amazon Resource Name (ARN) of the destination Amazon CloudWatch Logs log group.s3_configuration
bucket_name
- (Required) The name of the destination bucket.prefix
- (Optional) The bucket prefix.This resource exports the following attributes in addition to the arguments above:
id
- Experiment Template ID.In Terraform v1.5.0 and later, use an import
block to import FIS Experiment Templates using the id
. For example:
import {
to = aws_fis_experiment_template.template
id = "EXT123AbCdEfGhIjK"
}
Using terraform import
, import FIS Experiment Templates using the id
. For example:
% terraform import aws_fis_experiment_template.template EXT123AbCdEfGhIjK