Skip to content

Commit

Permalink
Increase the limit of deploymment names to 32 characters. (#13)
Browse files Browse the repository at this point in the history
The limit on deployment name length was largely an arbitrary decision and was used since it was expected to use the {{ deployment }} variable it creates for inclusion in naming terraform resources. This increases the arbitrary limit but does not completely remove limits because unbounded deployment lengths will cause problems when setting up remote backends.
  • Loading branch information
rmaynardap authored Mar 29, 2023
1 parent 414523a commit a8414f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def test_validate_deployment_invalid_spaces(self, capfd):
def test_validate_deployment_invalid_length(self, capfd):
"""ensure deploy over 16 chars fail"""
with pytest.raises(SystemExit) as e:
tfworker.cli.validate_deployment(None, None, "testtesttesttesttest")
tfworker.cli.validate_deployment(None, None, "testtesttesttesttesttesttesttesttesttest")
out, err = capfd.readouterr()
assert e.type == SystemExit
assert e.value.code == 1
assert "16 characters" in out
assert "32 characters" in out

def test_validate_gcp_creds_path(self):
"""ensure valid creds paths are returned"""
Expand Down
6 changes: 3 additions & 3 deletions tfworker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@


def validate_deployment(ctx, deployment, name):
"""Validate the deployment is no more than 16 characters."""
if len(name) > 16:
click.secho("deployment must be less than 16 characters", fg="red")
"""Validate the deployment is no more than 32 characters."""
if len(name) > 32:
click.secho("deployment must be less than 32 characters", fg="red")
raise SystemExit(1)
if " " in name:
click.secho("deployment must not contain spaces", fg="red")
Expand Down

0 comments on commit a8414f2

Please sign in to comment.