Repository navigation
Add user-bot Lambda infrastructure and slack_id user tag - #210
Merged
Merged
Conversation
|
Terraform plan in terraform Plan: 9 to add, 0 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_cloudwatch_event_rule.user_bot will be created
+ resource "aws_cloudwatch_event_rule" "user_bot" {
+ arn = (known after apply)
+ description = "Invokes the user-bot Lambda when an IAM user is given a console login profile"
+ event_bus_name = "default"
+ event_pattern = jsonencode(
{
+ detail = {
+ errorCode = [
+ {
+ exists = false
},
]
+ eventName = [
+ "CreateLoginProfile",
]
+ eventSource = [
+ "iam.amazonaws.com",
]
}
+ detail-type = [
+ "AWS API Call via CloudTrail",
]
+ source = [
+ "aws.iam",
]
}
)
+ force_destroy = false
+ id = (known after apply)
+ name = "user-bot-create-login-profile"
+ name_prefix = (known after apply)
+ region = "us-east-1"
+ tags_all = {
+ "managed-by" = "terraform-devops-security"
}
}
# aws_cloudwatch_event_target.user_bot will be created
+ resource "aws_cloudwatch_event_target" "user_bot" {
+ arn = (known after apply)
+ event_bus_name = "default"
+ force_destroy = false
+ id = (known after apply)
+ region = "us-east-1"
+ rule = "user-bot-create-login-profile"
+ target_id = (known after apply)
}
# aws_cloudwatch_log_group.user_bot will be created
+ resource "aws_cloudwatch_log_group" "user_bot" {
+ arn = (known after apply)
+ deletion_protection_enabled = (known after apply)
+ id = (known after apply)
+ log_group_class = (known after apply)
+ name = "/aws/lambda/user-bot"
+ name_prefix = (known after apply)
+ region = "us-east-1"
+ retention_in_days = 90
+ skip_destroy = false
+ tags_all = {
+ "managed-by" = "terraform-devops-security"
}
}
# aws_iam_role.user_bot will be created
+ resource "aws_iam_role" "user_bot" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRole"
+ Effect = "Allow"
+ Principal = {
+ Service = "lambda.amazonaws.com"
}
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "user-bot"
+ name_prefix = (known after apply)
+ path = "/"
+ tags_all = {
+ "managed-by" = "terraform-devops-security"
}
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# aws_iam_role.user_bot_deploy will be created
+ resource "aws_iam_role" "user_bot_deploy" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRoleWithWebIdentity"
+ Condition = {
+ StringEquals = {
+ "token.actions.githubusercontent.com:aud" = "*****************"
+ "token.actions.githubusercontent.com:sub" = "**************************************************"
}
}
+ Effect = "Allow"
+ Principal = {
+ Federated = "arn:aws:iam::035866691871:oidc-provider/token.actions.githubusercontent.com"
}
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "devops-security-user-bot-deploy"
+ name_prefix = (known after apply)
+ path = "/"
+ tags_all = {
+ "managed-by" = "terraform-devops-security"
}
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# aws_iam_role_policy.user_bot will be created
+ resource "aws_iam_role_policy" "user_bot" {
+ id = (known after apply)
+ name = "user-bot"
+ name_prefix = (known after apply)
+ policy = (known after apply)
+ role = (known after apply)
}
# aws_iam_role_policy.user_bot_deploy will be created
+ resource "aws_iam_role_policy" "user_bot_deploy" {
+ id = (known after apply)
+ name = "user-bot-deploy"
+ name_prefix = (known after apply)
+ policy = (known after apply)
+ role = (known after apply)
}
# aws_lambda_function.user_bot will be created
+ resource "aws_lambda_function" "user_bot" {
+ architectures = (known after apply)
+ arn = (known after apply)
+ code_sha256 = (known after apply)
+ description = "DMs new IAM users a temporary console password. Code is deployed by user-bot-deploy.yml in hackforla/devops-security."
+ filename = "./.terraform/user-bot-placeholder.zip"
+ function_name = "user-bot"
+ handler = "index.handler"
+ id = (known after apply)
+ invoke_arn = (known after apply)
+ last_modified = (known after apply)
+ memory_size = 128
+ package_type = "Zip"
+ publish = false
+ qualified_arn = (known after apply)
+ qualified_invoke_arn = (known after apply)
+ region = "us-east-1"
+ reserved_concurrent_executions = -1
+ response_streaming_invoke_arn = (known after apply)
+ role = (known after apply)
+ runtime = "nodejs24.x"
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
+ skip_destroy = false
+ source_code_hash = "LLba/aL0rfujZfe2GX308Af+BuAl7oqRUuVOV4dV1mo="
+ source_code_size = (known after apply)
+ tags_all = {
+ "managed-by" = "terraform-devops-security"
}
+ timeout = 30
+ version = (known after apply)
+ ephemeral_storage (known after apply)
+ logging_config (known after apply)
+ tracing_config (known after apply)
}
# aws_lambda_permission.user_bot_eventbridge will be created
+ resource "aws_lambda_permission" "user_bot_eventbridge" {
+ action = "lambda:InvokeFunction"
+ function_name = "user-bot"
+ id = (known after apply)
+ principal = "events.amazonaws.com"
+ region = "us-east-1"
+ source_arn = (known after apply)
+ statement_id = "*************************************"
+ statement_id_prefix = (known after apply)
}
Plan: 9 to add, 0 to change, 0 to destroy.✅ Plan applied in Apply Terraform changes on merge #50 |
This was referenced Oct 4, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #209 (PR 1 of 2: Terraform and the request form; the Lambda code and its workflows follow in PR 2)
What changes did you make?
aws-usersmodule: optionalslack_idinput, stored as aslack_idtag; validated as a Slack member IDterraform/user-bot.tf(us-east-1): EventBridge rule on successfulCreateLoginProfile, theuser-botLambda from a do-nothing placeholder, its log group, and an execution role that can only reset passwords of users taggedmanaged-by = terraform-devops-securitydevops-security-user-bot-deployOIDC role (main only,UpdateFunctionCode/GetFunctionon this function only) for PR 2's deploy workflowhashicorp/archiveprovider added; optional "Slack Member ID" field on the IAM request form; READMEs regeneratedWhy did you make the changes (we will use this info to test)?
region = "us-east-1"