Skip to content

Add validation for security_groups attribute #44981

@DBX12

Description

@DBX12

Description

It would be great if the provider would check if the provided value for security_groups is syntactically valid in the current context. For example, on aws_scheduler_schedule -> target -> ecs_parameters -> network_configuration, you can provide security groups. The AWS api accepts any value, but silently expects a security group ID not an ARN. You only realize this issue when you check why your scheduled task did not execute and see an error like this in CloudTrail:

Error retrieving security group information for [arn:aws:ec2:eu-central-1:000000000000:security-group/sg-123456, arn:aws:ec2:eu-central-1:000000000000:security-group/sg-abcdef]: Invalid id: "arn:aws:ec2:eu-central-1:000000000000:security-group/sg-123456" (expecting "sg-...") (ErrorCode: InvalidGroupId.Malformed)

Affected Resource(s) or Data Source(s)

  • aws_scheduler_schedule (when configuring a ECS RunTask target in the network block within ecs_parameters block)
  • aws_ecs_service (in the network_configuration block)

Probably everywhere where names.AttrSecurityGroups is used.

Potential Terraform Configuration

References

No response

Would you like to implement the enhancement?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequests to existing resources that expand the functionality or scope.service/ecsIssues and PRs that pertain to the ecs service.service/schedulerIssues and PRs that pertain to the scheduler service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions