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 secrets #59

Merged
merged 2 commits into from
Jun 28, 2024
Merged

Add secrets #59

merged 2 commits into from
Jun 28, 2024

Conversation

kunduso
Copy link
Owner

@kunduso kunduso commented Jun 28, 2024

This pr closes #57

@kunduso kunduso self-assigned this Jun 28, 2024
Copy link

💰 Infracost report

Monthly cost will increase by $0.40 📈

Changed project Baseline cost Usage cost* Total change New monthly cost
kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON +$0.40 +$0 +$0.40 (+1%) $62

*Usage costs can be estimated by updating Infracost Cloud settings, see docs for other options.

Cost details
Key: * usage cost, ~ changed, + added, - removed

──────────────────────────────────
Project: kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON

+ aws_secretsmanager_secret.ecs_secret
  +$0.40

    + Secret
      +$0.40

    + API requests
      Monthly cost depends on usage
        +$0.05 per 10k requests

Monthly cost change for kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON
Amount:  +$0.40 ($61 → $62)
Percent: +1%

──────────────────────────────────
Key: * usage cost, ~ changed, + added, - removed

*Usage costs can be estimated by updating Infracost Cloud settings, see docs for other options.

37 cloud resources were detected:
∙ 8 were estimated
∙ 29 were free

Infracost estimate: Monthly cost will increase by $0.40 ↑
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Changed project                                    ┃ Baseline cost ┃ Usage cost ┃ Total change ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
┃ kunduso/add-aws-ecr-ecs-fargate/infra/TFplan.JSON  ┃        +$0.40 ┃        +$0 ┃ +$0.40 (+1%) ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━━━━┛
This comment will be updated when code changes.

Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform
data.aws_caller_identity.current: Reading...
aws_service_discovery_http_namespace.namespace: Refreshing state... [id=ns-cc5i7ykaj67ppst3]
aws_kms_key.custom_kms_key: Refreshing state... [id=ef68e503-5cdd-4baf-9547-3d39d0e4a0c8]
aws_vpc.this: Refreshing state... [id=vpc-0177cbea506968866]
data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
aws_kms_key_policy.encrypt_app: Refreshing state... [id=ef68e503-5cdd-4baf-9547-3d39d0e4a0c8]
aws_kms_alias.key: Refreshing state... [id=alias/app-6]
aws_ecr_repository.image_repo: Refreshing state... [id=app-6]
aws_cloudwatch_log_group.logs: Refreshing state... [id=/amazon-ecs/app-6/log]
aws_ecs_cluster.app_cluster: Refreshing state... [id=arn:aws:ecs:us-east-2:743794601996:cluster/app-6]
aws_route_table.this_rt_private: Refreshing state... [id=rtb-076c0decdd5557da1]
aws_security_group.endpoint_sg: Refreshing state... [id=sg-0318f588f4818e5cf]
aws_subnet.public[0]: Refreshing state... [id=subnet-0265de33fcbcc74bf]
aws_subnet.private[0]: Refreshing state... [id=subnet-0da40b020a8b8fca6]
aws_subnet.private[1]: Refreshing state... [id=subnet-09b612ab68f8cf06d]
aws_subnet.public[1]: Refreshing state... [id=subnet-0ba781f8c180ec1c5]
aws_internet_gateway.this_igw: Refreshing state... [id=igw-0c1c35cd1eebdf561]
aws_lb_target_group.target_group: Refreshing state... [id=arn:aws:elasticloadbalancing:us-east-2:743794601996:targetgroup/app-6/82a24993ffc35e50]
aws_route_table.this_rt: Refreshing state... [id=rtb-0ee63cd483cdda2a6]
aws_security_group.custom_sg: Refreshing state... [id=sg-0f503030dfa8c9ef8]
aws_default_security_group.default: Refreshing state... [id=sg-0e90b718d992b31ea]
aws_vpc_endpoint.s3: Refreshing state... [id=vpce-08ac7d43bbc3bb49d]
aws_route.internet_route: Refreshing state... [id=r-rtb-0ee63cd483cdda2a61080289494]
aws_security_group_rule.egress_load_balancer: Refreshing state... [id=sgrule-4047886860]
aws_security_group_rule.ingress_load_balancer: Refreshing state... [id=sgrule-3057207847]
aws_security_group_rule.ingress_vpc_endpoint: Refreshing state... [id=sgrule-993827166]
aws_vpc_endpoint.cloudwatch: Refreshing state... [id=vpce-0accdb89f1535e6c5]
aws_vpc_endpoint.ecr_api: Refreshing state... [id=vpce-07314797ccaba5e5f]
aws_route_table_association.private[1]: Refreshing state... [id=rtbassoc-05abae80d12bb9a36]
aws_route_table_association.private[0]: Refreshing state... [id=rtbassoc-0dfbe27f944a69c10]
aws_vpc_endpoint.ecr: Refreshing state... [id=vpce-0eda08325c5d33c42]
aws_lb.app_lb: Refreshing state... [id=arn:aws:elasticloadbalancing:us-east-2:743794601996:loadbalancer/app/app-6/dd3117db6f42b247]
aws_route_table_association.public[1]: Refreshing state... [id=rtbassoc-01e8adeb6b52b7d82]
aws_route_table_association.public[0]: Refreshing state... [id=rtbassoc-068a2547cce99ca0d]
aws_ssm_parameter.infra_output: Refreshing state... [id=/app-6/output]
aws_vpc_endpoint_route_table_association.s3_association: Refreshing state... [id=a-vpce-08ac7d43bbc3bb49d1013104409]
aws_alb_listener.listener: Refreshing state... [id=arn:aws:elasticloadbalancing:us-east-2:743794601996:listener/app/app-6/dd3117db6f42b247/c55f4e74a4a42cba]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # aws_secretsmanager_secret.ecs_secret will be created
  + resource "aws_secretsmanager_secret" "ecs_secret" {
      + arn                            = (known after apply)
      + force_overwrite_replica_secret = false
      + id                             = (known after apply)
      + kms_key_id                     = "ef68e503-5cdd-4baf-9547-3d39d0e4a0c8"
      + name                           = "ecs_secret"
      + name_prefix                    = (known after apply)
      + policy                         = (known after apply)
      + recovery_window_in_days        = 0
      + tags_all                       = {
          + "Source" = "https://github.com/kunduso/add-aws-ecr-ecs-fargate"
        }

      + replica (known after apply)
    }

  # aws_secretsmanager_secret_version.ecs_secret_version will be created
  + resource "aws_secretsmanager_secret_version" "ecs_secret_version" {
      + arn            = (known after apply)
      + id             = (known after apply)
      + secret_id      = (known after apply)
      + secret_string  = (sensitive value)
      + version_id     = (known after apply)
      + version_stages = (known after apply)
    }

  # aws_ssm_parameter.infra_output will be updated in-place
  ~ resource "aws_ssm_parameter" "infra_output" {
        id              = "/app-6/output"
      + insecure_value  = (known after apply)
        name            = "/app-6/output"
        tags            = {}
      ~ value           = (sensitive value)
      ~ version         = 2 -> (known after apply)
        # (8 unchanged attributes hidden)
    }

Plan: 2 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: TFplan.JSON

To perform exactly these actions, run the following command to apply:
    terraform apply "TFplan.JSON"

Pushed by: @kunduso, Action: pull_request

Comment on lines +2 to +7
resource "aws_secretsmanager_secret" "ecs_secret" {
#checkov:skip=CKV2_AWS_57: This variable does not need to be rotated
name = "ecs_secret"
recovery_window_in_days = 0
kms_key_id = aws_kms_key.custom_kms_key.id
}

Check warning

Code scanning / checkov

Ensure Secrets Manager secrets should have automatic rotation enabled Warning

Ensure Secrets Manager secrets should have automatic rotation enabled
@kunduso kunduso merged commit a1f2ea0 into main Jun 28, 2024
4 checks passed
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.

Add secrets to the infrastructure stack
1 participant