-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TF FIS action aws:ecs:stop-task validates fine (only 5 allowed values), but when apply cause ValidationException #26501
Comments
Hey @dhartford 👋 Thank you for taking the time to raise this! Admittedly, this isn't a resource I've encountered before, but I did a bit of reading and believe I may have figured out what the issue is here. I think the AWS API error message that's getting passed through isn't very helpful in this case, as I don't think the Based on those documents, I suspect the issue here is that you need to define a 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"
}
}
} |
thanks for taking a peek @justinretzolk , I've updated with the full configuration example (modified for sensitive information). |
Further trial/error, honing in on that is something around these values that are the challenge related to the aws:ecs:stop-task action id: fis action: action_id = "aws:ecs:stop-task"fis target: resource_type = "aws:ecs:task"FURTHER clarification, it seems the drain-container only works on EC2 launch types in ECS, -not- Fargate, so the aws:ecs:stop-task is critically important for fargate based workloads This is based on the below being able to terraform apply fine, while the original aws:ecs:stop-task would error with validationexception. One of the usecases was to do chaos testing on full AZ down (simulate unexpected) so a full stop-task would be more relevant than a drain for this scenario. resource "aws_fis_experiment_template" "fis_test" {
action {
name = "terminateFargateTasks"
# action_id = "aws:ecs:stop-task"
action_id = "aws:ecs:drain-container-instances"
role_arn = "arn:aws:iam::XXXX:role/FisRole"
#required only for aws:ecs:drain-container-instances
parameter {
key = "drainagePercentage"
value = "100"
}
#key: Clusters, DBInstances (RDS), Instances (Ec2) ##2022-08-25 ValidationException: Unexpected target "Clusters" found in action
target {
key = "Clusters" #Clusters is failing oddly...but 'terraform validate' is passing. Putting in "asdf" terraform validate fails. (TF 0.14.7 cli / aws 4.27.0)
value = "target-fargatetasks"
}
}// end action
target {
name = "target-fargatetasks"
# resource_type = "aws:ecs:task"
resource_type = "aws:ecs:cluster"
selection_mode = "ALL" #case sensitive, ALL, COUNT(number),PERCENT(number)
resource_tag {
key = "STAGE"
value = "dev"
}
filter {
path = "Placement.AvailabilityZone"
values = ["us-east-1a"]
}
filter{
path = "State.Name"
values = ["running"]
}
}//end target
} |
Any work arounds? Seems like we are still not able to create FIS templates via TF with the aws:ecs:stop-task action. or Any way we can add Tasks for ECS as a acceptable target key? |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v0.14.7
Affected Resource(s)
aws_fis_experiment_template
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Expected Behavior
terraform apply should have been successful without validation exception.
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
When changing target to lowercase 'clusters':
References
The text was updated successfully, but these errors were encountered: