Terraform v0.11.11
provider "aws" (1.56.0)
I've removed all non-relevant data:
Original state:
resource "aws_ssm_maintenance_window_task" "foo" {
window_id = "${aws_ssm_maintenance_window.foo.id}"
task_type = "RUN_COMMAND"
task_arn = "AWS-RunPatchBaseline"
service_role_arn = "${aws_iam_service_linked_role.ssm_maintenance_service_role.arn}"
max_concurrency = "1"
max_errors = "100"
targets {
key = "WindowTargetIds"
values = ["${aws_ssm_maintenance_window_target.foo.id}"]
}
task_parameters {
name = "Operation"
values = ["Install"]
}
logging_info {
s3_bucket_name = "foo"
s3_bucket_prefix = "amazon-patch"
s3_region = "eu-west-1"
}
}
Desired state:
resource "aws_ssm_maintenance_window_task" "foo" {
window_id = "${aws_ssm_maintenance_window.foo.id}"
task_type = "RUN_COMMAND"
task_arn = "AWS-RunPatchBaseline"
service_role_arn = "${aws_iam_service_linked_role.ssm_maintenance_service_role.arn}"
max_concurrency = "1"
max_errors = "100"
targets {
key = "WindowTargetIds"
values = ["${aws_ssm_maintenance_window_target.foo.id}"]
}
task_parameters {
name = "Operation"
values = ["Install"]
}
logging_info {
s3_bucket_name = "bar"
s3_bucket_prefix = "amazon-patch"
s3_region = "eu-west-1"
}
}
Terraform updates the S3 bucket used for logging, either by updating the resource in-place or recreating the resource
terraform apply the original stateterraform apply the desired state to update the logging bucket nameRelevant file: https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_ssm_maintenance_window_task.go
Relevant documentation: https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_UpdateMaintenanceWindowTask.html
LoggingInfo
The new logging location in Amazon S3 to specify.
Note
LoggingInfo has been deprecated. To specify an S3 bucket to contain logs, instead use the OutputS3BucketName and OutputS3KeyPrefix options in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported Maintenance Window task types, see MaintenanceWindowTaskInvocationParameters.
Type: LoggingInfo object
And relevant Go documentation: https://docs.aws.amazon.com/sdk-for-go/api/service/ssm/#MaintenanceWindowTaskInvocationParameters
Hi @jeohist 👋Thanks for reporting this and apologies for the unexpected behavior here! This type of resource schema bug is similar to #7351 so at the very least, the resource schema should be updated to include ForceNew: true for the attributes under logging_info attribute so updates to the Terraform configuration at least automatically trigger resource recreation. Ideally though as you mention, the resource should preferably be enhanced to include update functionality for certain attributes. I'm going to leave this issue marked as a bug since Terraform is incorrectly handling this situation without manual operator intervention.
Support for updates with the aws_ssm_maintenance_window_task resource and a new task_invocation_parameters configuration block in the aws_ssm_maintenance_window_task resource (to replace the deprecated logging_info configuration block) has been merged and will release with version 2.20.0 of the Terraform AWS Provider, expected later this week. Thanks to @kterada0509 for the implementation work. 👍
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.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!