Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attach iam instance profile #34

Merged
merged 2 commits into from
Jan 26, 2021
Merged

add attach iam instance profile #34

merged 2 commits into from
Jan 26, 2021

Conversation

brycahta
Copy link
Contributor

Issue #, if available: N/A-- adding more features

Description of changes:

  • Users can now attach an IAM Instance Profile to an instance at launch
    • supports both non and interactive modes
  • Added unit tests and mocks for the new feature
  • Updated existing unit tests because they weren't passing
  • Fix minor typos

Testing:

  • unit tests
  • local testing on aws account
    • list instance profiles pagination works
    • selected profile is attached to the instance as expected

Output table:

Please select an IAM Profile: 
[Press enter to choose default: Do not attach IAM profile]
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| OPTION |                                   PROFILE NAME                                    |      PROFILE ID       |         CREATION DATE         |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 1.     | Admin-role-meeeep                                                                 | AIPAXP7MEEEPLUYCUJU3W | 2020-06-05 16:54:16 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 2.     | eksctl-nth-eks-cluster-test-nodegroup-windows-ng-NodeInstanceProfile-F5X2XW7I0AX5 | AIPAXP7DUN6CM2C4BYPFC | 2020-07-20 20:32:31 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 3.     | Instance-Profile-1                                                                | AIPAXP7DUN6CORG253IFG | 2021-01-20 14:31:28 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 4.     | Instance-Profile-2                                                                | AIPAXP7DUN6CJLXGLI2M5 | 2021-01-20 14:31:51 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 5.     | Instance-Profile-3                                                                | AIPAXP7DUN6CFUJT5Q6VR | 2021-01-20 14:32:14 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 6.     | Instance-Profile-4                                                                | AIPAXP7DUN6CEPIBXYJQ4 | 2021-01-20 14:32:32 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 7.     | Instance-Profile-5                                                                | AIPAXP7DUN6CAYUMXFVTI | 2021-01-20 14:32:53 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 8.     | NodeInstanceRole                                                                  | AIPAXP7DUN6CKHHM7YPYQ | 2020-07-06 17:28:25 +0000 UTC |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
| 9.     | Do not attach IAM profile                                                         |                       |                               |
+--------+-----------------------------------------------------------------------------------+-----------------------+-------------------------------+
Your Choice >> 5

Please confirm if you would like to launch instance with following options: 

+--------------------------------------+--------------------------+
| Region                               | us-east-1                |
+--------------------------------------+--------------------------+
| VPC                                  | vpc-d295a6a8             |
+--------------------------------------+--------------------------+
| Subnet                               | subnet-0f0fd0423d9a6183e |
+--------------------------------------+--------------------------+
| Instance Type                        | t1.micro                 |
+--------------------------------------+--------------------------+
| Image                                | ami-0be2609ba883822ec    |
+--------------------------------------+--------------------------+
| Security Group                       | sg-819314ab              |
+--------------------------------------+--------------------------+
| Keep EBS Volume(s) After Termination | false                    |
+--------------------------------------+--------------------------+
| Auto Termination Timer in Minutes    | None                     |
+--------------------------------------+--------------------------+
| EBS Volumes                          | /dev/xvda(gp2): 8 GiB    |
+--------------------------------------+--------------------------+
| IAM Instance Profile                 | Instance-Profile-3       |
+--------------------------------------+--------------------------+
[ yes / no ]
Your Choice >> yes
Options confirmed! Launching instance...
Launch Instance Success!
Instance ID: i-08e3f935e51d6891b

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@brycahta brycahta requested a review from pdk27 January 20, 2021 20:13
Copy link
Contributor

@pdk27 pdk27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left some minor comments.

cmd/launch.go Show resolved Hide resolved
cmd/launch.go Show resolved Hide resolved
pkg/question/question.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pdk27 pdk27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants