-
Notifications
You must be signed in to change notification settings - Fork 10k
New List Resource: aws_iam_user
#46869
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
63b464f
r/aws_iam_user: add resource identity support
jar-b 5dee9fc
names: add `human_friendly_short` for `iam` service
jar-b c974c60
r/aws_iam_user: add list support
jar-b a8778d4
r/aws_iam_user(test): additional `_List_includeResource` checks
jar-b 3a3da1a
r/aws_iam_user: post-rebase build fix
jar-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ```release-note:new-list-resource | ||
| aws_iam_user | ||
| ``` | ||
| ```release-note:enhancement | ||
| resource/aws_iam_user: Add resource identity support | ||
| ``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| resource "aws_iam_user" "test" { | ||
| name = var.rName | ||
| } | ||
|
|
||
| variable "rName" { | ||
| description = "Name for resource" | ||
| type = string | ||
| nullable = false | ||
| } |
22 changes: 22 additions & 0 deletions
22
internal/service/iam/testdata/User/basic_v6.35.1/main_gen.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| resource "aws_iam_user" "test" { | ||
| name = var.rName | ||
| } | ||
|
|
||
| variable "rName" { | ||
| description = "Name for resource" | ||
| type = string | ||
| nullable = false | ||
| } | ||
| terraform { | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = "6.35.1" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "aws" {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| resource "aws_iam_user" "test" { | ||
| count = var.resource_count | ||
|
|
||
| name = "${var.rName}-${count.index}" | ||
| } | ||
|
|
||
| variable "rName" { | ||
| description = "Name for resource" | ||
| type = string | ||
| nullable = false | ||
| } | ||
|
|
||
| variable "resource_count" { | ||
| description = "Number of resources to create" | ||
| type = number | ||
| nullable = false | ||
| } |
6 changes: 6 additions & 0 deletions
6
internal/service/iam/testdata/User/list_basic/query.tfquery.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| list "aws_iam_user" "test" { | ||
| provider = aws | ||
| } |
28 changes: 28 additions & 0 deletions
28
internal/service/iam/testdata/User/list_include_resource/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| resource "aws_iam_user" "test" { | ||
| count = var.resource_count | ||
|
|
||
| name = "${var.rName}-${count.index}" | ||
|
|
||
| tags = var.resource_tags | ||
| } | ||
|
|
||
| variable "rName" { | ||
| description = "Name for resource" | ||
| type = string | ||
| nullable = false | ||
| } | ||
|
|
||
| variable "resource_count" { | ||
| description = "Number of resources to create" | ||
| type = number | ||
| nullable = false | ||
| } | ||
|
|
||
| variable "resource_tags" { | ||
| description = "Tags to set on resource" | ||
| type = map(string) | ||
| nullable = false | ||
| } |
8 changes: 8 additions & 0 deletions
8
internal/service/iam/testdata/User/list_include_resource/query.tfquery.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| list "aws_iam_user" "test" { | ||
| provider = aws | ||
|
|
||
| include_resource = true | ||
| } |
40 changes: 40 additions & 0 deletions
40
internal/service/iam/testdata/User/list_path_prefix/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| resource "aws_iam_user" "expected" { | ||
| count = var.resource_count | ||
|
|
||
| name = "${var.rName}-${count.index}" | ||
| path = var.expected_path_name | ||
| } | ||
|
|
||
| resource "aws_iam_user" "not_expected" { | ||
| count = var.resource_count | ||
|
|
||
| name = "${var.rName}-other-${count.index}" | ||
| path = var.other_path_name | ||
| } | ||
|
|
||
| variable "rName" { | ||
| description = "Name for resource" | ||
| type = string | ||
| nullable = false | ||
| } | ||
|
|
||
| variable "resource_count" { | ||
| description = "Number of resources to create" | ||
| type = number | ||
| nullable = false | ||
| } | ||
|
|
||
| variable "expected_path_name" { | ||
| description = "Path name for expected resources" | ||
| type = string | ||
| nullable = false | ||
| } | ||
|
|
||
| variable "other_path_name" { | ||
| description = "Path name for non-expected resources" | ||
| type = string | ||
| nullable = false | ||
| } |
10 changes: 10 additions & 0 deletions
10
internal/service/iam/testdata/User/list_path_prefix/query.tfquery.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright IBM Corp. 2014, 2026 | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| list "aws_iam_user" "test" { | ||
| provider = aws | ||
|
|
||
| config { | ||
| path_prefix = var.expected_path_name | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identity is mutable because the provider allows name and path can be modified in place.
Perhaps this is something we reconsider in a future major version, but for now I'm not sure we can avoid marking it this way without breaking existing behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AWS API also allows changing the name and path in-place.
Technically, the
UserId(exposed asunique_idin the provider) is the stable unique identifier, but it's not exposed to the user, so not useful for import.Alternatively, we could use
unique_idas the Identifier, but theGetUserandListUsersAPI calls aren't documented to accept the value, just the name. This would require a "full table scan" for reading IAM Users.