You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add !aws.organization_id YAML function (#2117)
* feat: add !aws.organization_id YAML function (#2073)
Add a new `!aws.organization_id` YAML function that retrieves the AWS
Organization ID by calling the AWS Organizations DescribeOrganization API.
This complements the existing AWS context functions and is equivalent to
Terragrunt's `get_aws_org_id()`.
- Create `pkg/aws/organization/` package with Getter interface, caching,
and mock support (parallel to `pkg/aws/identity/`)
- Register tag constants in both modern (`pkg/function/tags.go`) and
legacy (`pkg/utils/yaml_utils.go`) layers
- Implement modern layer function in `pkg/function/aws.go`
- Implement legacy layer handler in `internal/exec/yaml_func_aws.go`
- Add routing in `internal/exec/yaml_func_utils.go`
- Add comprehensive unit tests across all three layers
- Add documentation, blog post, PRD, and roadmap update
- Update Go version references from 1.24/1.25 to 1.26
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add Atmos Auth integration details to !aws.organization_id
Document how the function integrates with Atmos Authentication,
including auth context flow, credential resolution, stack-level
configuration, and per-auth-context caching.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [autofix.ci] apply automated fixes
* fix: add AtmosYamlFuncAwsOrganizationID to yaml_utils_test.go expected tags
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review - generated mocks, nil guard, error tests, pr number
- Replace manual mocks with generated MockGetter (go.uber.org/mock) in
organization_test.go and aws_test.go per repo conventions
- Add defensive nil/empty guard before dereferencing orgInfo in
processTagAwsOrganizationID (legacy layer)
- Add subprocess-based error path tests for processTagAwsOrganizationID
(getter error, nil info, empty ID all cause os.Exit)
- Wrap config-loading error with ErrAwsDescribeOrganization using
standard ErrWrapFormat pattern
- Add pr: 2117 to roadmap milestone
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [autofix.ci] apply automated fixes
* fix: address remaining PR review comments
- Replace manual mockAWSOrganizationGetter and countingAWSOrgGetter with
generated awsOrg.NewMockGetter(ctrl) in internal/exec tests
- Anchor -test.run regex with ^...$ in subprocess error tests
- Return wrapped error instead of empty info when Organization payload is nil
- Guard SetGetter against nil injection (falls back to defaultGetter)
- Revert golden snapshots to main (remove env-specific gh auth debug line)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review comments and improve test coverage to 95%
- Replace manual mocks with gomock-generated mocks across all test files
- Tighten mock expectations from AnyTimes() to Times(1)
- Add specific exit code assertion in subprocess error tests
- Add organizationsAPI interface + injectable factory variables for
testable defaultGetter.GetOrganization (was 0%, now 100%)
- Add TestSetGetter_NilFallback for nil guard branch coverage
- Add 7 defaultGetter unit tests: success, nil fields, config error,
describe error, not-in-org error, nil payload, auth context passthrough
- Regenerate mock_organization.go with both Getter and organizationsAPI
- Overall organization package coverage: 47.88% → 95.3%
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: guard nil output, collision-safe cache keys, revert snapshots
- Guard nil DescribeOrganization output before dereferencing Organization
- Add TestDefaultGetter_GetOrganization_NilOutput for the new guard
- Make cache keys collision-safe using %q with | delimiter
- Revert golden snapshots to remove env-specific gh auth debug line
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
0 commit comments