observability-with-amazon-opensearch icon indicating copy to clipboard operation
observability-with-amazon-opensearch copied to clipboard

fix: defining role naming to avoid side-effects

Open ibrahimcesar opened this issue 1 year ago • 0 comments

Description of changes:

While working on some iterations I got the following error that makes the Stack fail at creation:

1 validation error detected: Value 'Linux-SSMRoletoEC2-observability-with-amazon-opensearch-OpenSearch-114E9CRBKAPMT' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64

The previous code generates the role name to RoleName: !Sub Linux-SSMRoletoEC2-${AWS::StackName} since the Stack Name is defined for the users, and the Stack Name can be up to 128 characters, there's not a fail-safe to interpolate this string (or, at least, in my knowledge. Is possible to trim strings in CF at runtime?). Since roles names should be less or equal to 64 this can lead to bad experiences in workshops. I'm changing to this hardcoded name: Linux-SSMRoletoEC2-OpenSearch-Workshop.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

ibrahimcesar avatar Oct 15 '22 21:10 ibrahimcesar