Skip to content

Commit ef01bb6

Browse files
authored
Merge pull request #18 from PostHog/tom/fix-tests
Fix formatting and update terraform docs
2 parents 5f22d67 + a346561 commit ef01bb6

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

CLAUDE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Claude Code Instructions
2+
3+
## Before Committing
4+
5+
Always run these commands before committing changes:
6+
7+
```bash
8+
# Fix linting errors and format code
9+
cd src && uv run ruff check --fix . && uv run ruff format .
10+
11+
# Update terraform documentation
12+
cd /Users/tom/Documents/projects/terraform-aws-sso-elevator && terraform-docs markdown table --output-file README.md --output-mode inject .
13+
```
14+
15+
## Running Tests
16+
17+
```bash
18+
cd src && uv run pytest -q
19+
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ settings:
791791
| <a name="input_event_brige_check_on_inconsistency_rule_name"></a> [event\_brige\_check\_on\_inconsistency\_rule\_name](#input\_event\_brige\_check\_on\_inconsistency\_rule\_name) | DEPRECATED: Use event\_bridge\_check\_on\_inconsistency\_rule\_name instead. This variable contains a typo and will be removed in a future version. | `string` | `"sso-elevator-check-on-inconsistency"` | no |
792792
| <a name="input_event_brige_scheduled_revocation_rule_name"></a> [event\_brige\_scheduled\_revocation\_rule\_name](#input\_event\_brige\_scheduled\_revocation\_rule\_name) | DEPRECATED: Use event\_bridge\_scheduled\_revocation\_rule\_name instead. This variable contains a typo and will be removed in a future version. | `string` | `"sso-elevator-scheduled-revocation"` | no |
793793
| <a name="input_group_config"></a> [group\_config](#input\_group\_config) | value for the SSO Elevator group config | `any` | `[]` | no |
794-
| <a name="input_identity_store_id"></a> [identity\_store\_id](#input\_identity\_store\_id) | The Identity Store ID. If not provided and sso\_instance\_arn is also not provided, it will be automatically discovered. | `string` | `""` | no |
794+
| <a name="input_identity_store_id"></a> [identity\_store\_id](#input\_identity\_store\_id) | The Identity Store ID (e.g., "d-1234567890").<br/>If not provided and sso\_instance\_arn is also not provided, it will be automatically discovered.<br/><br/>Providing this value is RECOMMENDED for API efficiency - it eliminates describe\_sso\_instance API calls<br/>on every Lambda invocation. You can find this value in the AWS IAM Identity Center console or via:<br/> aws sso-admin list-instances --query 'Instances[0].IdentityStoreId' --output text | `string` | `""` | no |
795795
| <a name="input_lambda_architecture"></a> [lambda\_architecture](#input\_lambda\_architecture) | The instruction set architecture for Lambda functions. Valid values are 'x86\_64' or 'arm64'. Use 'arm64' for better price/performance on Graviton2. | `string` | `"x86_64"` | no |
796796
| <a name="input_lambda_memory_size"></a> [lambda\_memory\_size](#input\_lambda\_memory\_size) | Amount of memory in MB your Lambda Function can use at runtime. Valid value between 128 MB to 10,240 MB (10 GB), in 64 MB increments. | `number` | `256` | no |
797797
| <a name="input_lambda_timeout"></a> [lambda\_timeout](#input\_lambda\_timeout) | The amount of time your Lambda Function has to run in seconds. | `number` | `30` | no |

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def load_select_options_for_account_access_request(client: WebClient, body: dict
220220

221221

222222
@handle_errors
223-
def handle_button_click(body: dict, client: WebClient, context: BoltContext) -> SlackResponse: # noqa: ARG001
223+
def handle_button_click(body: dict, client: WebClient, context: BoltContext) -> SlackResponse: # noqa: ARG001, PLR0915
224224
logger.info("Handling button click")
225225
try:
226226
payload = slack_helpers.ButtonClickedPayload.model_validate(body)

src/sso.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ def get_permission_sets_from_config(client: SSOAdminClient, cfg: config.Config)
470470
permission_sets = list(list_permission_sets(client, cfg.sso_instance_arn))
471471
else:
472472
permission_sets = [
473-
ps for ps in list_permission_sets(client, cfg.sso_instance_arn)
473+
ps
474+
for ps in list_permission_sets(client, cfg.sso_instance_arn)
474475
if ps.name in cfg.permission_sets or ps.arn in cfg.permission_sets
475476
]
476477
return permission_sets

src/statement.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ def get_affected_statements(
4848
permission_set_name: str,
4949
permission_set_arn: str | None = None,
5050
) -> FrozenSet[Statement]:
51-
return frozenset(
52-
statement for statement in statements
53-
if statement.affects(account_id, permission_set_name, permission_set_arn)
54-
)
51+
return frozenset(statement for statement in statements if statement.affects(account_id, permission_set_name, permission_set_arn))
5552

5653

5754
def get_permission_sets_for_account(statements: FrozenSet[Statement], account_id: str) -> set[str]:

0 commit comments

Comments
 (0)