Skip to content
This repository was archived by the owner on Apr 27, 2020. It is now read-only.

Commit 3abd7bb

Browse files
stijndehaessuperbrothers
authored andcommitted
Add support for aws credentials (#71)
1 parent f1cfb81 commit 3abd7bb

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Werner Buck
1111
Lucas de Haas
1212
Daniel Jensen
1313
Jens Herrmann
14+
Stijn De Haes

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ The version of this resource corresponds to the version of kubectl. We recommend
4545
- `use_aws_iam_authenticator`: *Optional.* If true, the aws_iam_authenticator, required for connecting with EKS, is used. Requires `aws_eks_cluster_name`. Defaults to `false`.
4646
- `aws_eks_cluster_name`: *Optional.* the AWS EKS cluster name, required when `use_aws_iam_authenticator` is true.
4747
- `aws_eks_assume_role`: *Optional.* the AWS IAM role ARN to assume.
48+
- `aws_access_key_id`: *Optional.* AWS access key to use for iam authenticator.
49+
- `aws_secret_access_key`: *Optional.* AWS secret key to use for iam authenticator.
50+
- `aws_session_token`: *Optional.* AWS session token (assumed role) to use for iam authenticator.
4851

4952
## Behavior
5053

assets/out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ cd "$source_dir"
2828
payload=$(mktemp "$TMPDIR/kubernetes-resource-request.XXXXXX")
2929
cat > "$payload" <&0
3030

31+
AWS_ACCESS_KEY_ID=$(jq -r '.source.aws_access_key_id // ""' < "$payload")
32+
export AWS_ACCESS_KEY_ID
33+
AWS_SECRET_ACCESS_KEY=$(jq -r '.source.aws_secret_access_key // ""' < "$payload")
34+
export AWS_SECRET_ACCESS_KEY
35+
AWS_SESSION_TOKEN=$(jq -r '.source.aws_session_token // ""' < "$payload")
36+
export AWS_SESSION_TOKEN
37+
3138
setup_kubectl "$payload"
3239

3340
# Required. Specify the operation that you want to perform on one or more

test/suite.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ teardown() {
4646
assert_not_match 'did not find expected key' "$output"
4747
}
4848

49+
@test "with outputs.aws_access_credentials" {
50+
run assets/out <<< "$(jq -n '{"source": {"use_aws_iam_authenticator": true, "aws_eks_cluster_name": "eks-cluster01", "aws_access_key_id": "KEY", "aws_secret_access_key": "SECRET", "aws_session_token": "Session", "server": $server, "token": $token}, "params": {"kubectl": "get po"}}' \
51+
--arg server "$server" \
52+
--arg token "$token")"
53+
assert_not_match 'did not find expected key' "$output"
54+
}
55+
4956
@test "with source.kubeconfig" {
5057
run assets/out <<< "$(jq -n '{"source": {"kubeconfig": $kubeconfig}, "params": {"kubectl": $kubectl, "wait_until_ready": 60}}' \
5158
--arg kubeconfig "$(cat "$kubeconfig_file")" \

0 commit comments

Comments
 (0)