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

Use vpc module #44

Merged
merged 21 commits into from
Nov 19, 2024
Merged

Use vpc module #44

merged 21 commits into from
Nov 19, 2024

Conversation

kunduso
Copy link
Owner

@kunduso kunduso commented Nov 19, 2024

The changes in this PR closes #43, closes #42 , and closes #41

@kunduso kunduso self-assigned this Nov 19, 2024
Copy link
Contributor

github-actions bot commented Nov 19, 2024

💰 Infracost report

Monthly estimate generated

This comment will be updated when code changes.

Copy link
Contributor

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform
random_password.auth: Refreshing state... [id=none]
module.vpc.data.aws_availability_zones.available: Reading...
module.vpc.data.aws_iam_policy_document.assume_role: Reading...
aws_kms_key.encryption_secret: Refreshing state... [id=739b15af-9806-403d-88b3-2f1cd20bbba7]
module.vpc.data.aws_iam_policy_document.assume_role: Read complete after 0s [id=2717921857]
aws_kms_key.encryption_rest: Refreshing state... [id=c54ba30e-d0f8-4c69-99f9-a41ad1960b25]
data.aws_caller_identity.current: Reading...
module.vpc.aws_vpc.this: Refreshing state... [id=vpc-0eda41e1d4acb30a0]
aws_iam_role.ec2_role: Refreshing state... [id=app-4-ec2-role]
module.vpc.data.aws_caller_identity.current: Reading...
data.aws_ami.amazon_ami: Reading...
module.vpc.aws_iam_role.vpc_flow_log_role[0]: Refreshing state... [id=app-4-vpc-flow-role]
module.vpc.aws_kms_key.custom_kms_key[0]: Refreshing state... [id=db92469c-1549-4621-a376-47c3ce70cf4e]
module.vpc.data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
module.vpc.data.aws_availability_zones.available: Read complete after 0s [id=us-east-2]
data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
aws_kms_alias.encryption_secret: Refreshing state... [id=alias/app-4-encryption-secret]
aws_kms_key_policy.encryption_secret_policy: Refreshing state... [id=739b15af-9806-403d-88b3-2f1cd20bbba7]
aws_secretsmanager_secret.elasticache_auth: Refreshing state... [id=arn:aws:secretsmanager:us-east-2:743794601996:secret:app-4-elasticache-auth-XDfYTm]
aws_kms_key_policy.encryption_rest_policy: Refreshing state... [id=c54ba30e-d0f8-4c69-99f9-a41ad1960b25]
aws_cloudwatch_log_group.slow_log: Refreshing state... [id=/elasticache/app-4/slow-log]
aws_cloudwatch_log_group.engine_log: Refreshing state... [id=/elasticache/app-4/engine-log]
aws_kms_alias.encryption_rest: Refreshing state... [id=alias/app-4-encryption-rest]
module.vpc.aws_cloudwatch_log_group.network_flow_logging[0]: Refreshing state... [id=app-4-flow-logs]
module.vpc.aws_kms_alias.key[0]: Refreshing state... [id=alias/app-4]
data.aws_ami.amazon_ami: Read complete after 1s [id=ami-0ec5c7d8262c1f6b2]
module.vpc.aws_kms_key_policy.encrypt_log[0]: Refreshing state... [id=db92469c-1549-4621-a376-47c3ce70cf4e]
aws_iam_instance_profile.ec2_profile: Refreshing state... [id=app-4-ec2-profile]
aws_iam_role_policy_attachment.custom: Refreshing state... [id=app-4-ec2-role-20241118213130709800000001]
aws_secretsmanager_secret_version.auth: Refreshing state... [id=arn:aws:secretsmanager:us-east-2:743794601996:secret:app-4-elasticache-auth-XDfYTm|EF916D7A-C981-433B-A0B5-71A108A38415]
aws_iam_policy.secret_manager_policy: Refreshing state... [id=arn:aws:iam::743794601996:policy/app-4-secret-read-policy]
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Reading...
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Read complete after 0s [id=3531817074]
module.vpc.aws_iam_role_policy.vpc_flow_log_role_policy[0]: Refreshing state... [id=app-4-vpc-flow-role:app-4-vpc-flow-policy]
aws_iam_role_policy_attachment.secret_policy_attachement: Refreshing state... [id=app-4-ec2-role-20241118213140146900000002]
module.vpc.aws_default_security_group.default: Refreshing state... [id=sg-0ff24486bc390b0b2]
module.vpc.aws_subnet.private[0]: Refreshing state... [id=subnet-04fbc3644652e06d8]
module.vpc.aws_route_table.public: Refreshing state... [id=rtb-0da6d9727076537b3]
module.vpc.aws_internet_gateway.this_igw[0]: Refreshing state... [id=igw-0bd8d6cf40d4dba2a]
module.vpc.aws_subnet.private[2]: Refreshing state... [id=subnet-004e4c7774e46164d]
module.vpc.aws_route_table.private[2]: Refreshing state... [id=rtb-0aa1df9aea6f4ad04]
module.vpc.aws_route_table.private[0]: Refreshing state... [id=rtb-09e8e540278140013]
module.vpc.aws_subnet.private[1]: Refreshing state... [id=subnet-0e64918e1dbb85a32]
module.vpc.aws_route_table.private[1]: Refreshing state... [id=rtb-01b396b6c391b876f]
module.vpc.aws_flow_log.network_flow_logging[0]: Refreshing state... [id=fl-0db24eee845fdc949]
module.vpc.aws_subnet.public[0]: Refreshing state... [id=subnet-0ca7a2d909fbc14c4]
aws_security_group.elasticache: Refreshing state... [id=sg-0f81d7d37df9dc150]
aws_security_group.ec2_instance: Refreshing state... [id=sg-0d127b38a829339ef]
module.vpc.aws_route.internet_route[0]: Refreshing state... [id=r-rtb-0da6d9727076537b31080289494]
aws_security_group_rule.elasticache_egress: Refreshing state... [id=sgrule-3098933277]
aws_security_group_rule.elasticache_ingress: Refreshing state... [id=sgrule-2581578492]
module.vpc.aws_route_table_association.public[0]: Refreshing state... [id=rtbassoc-0bbc9788b691bde37]
module.vpc.aws_route_table_association.private[1]: Refreshing state... [id=rtbassoc-06bbf4b1bcca3593d]
module.vpc.aws_route_table_association.private[2]: Refreshing state... [id=rtbassoc-07b0238a2c23b1a29]
module.vpc.aws_route_table_association.private[0]: Refreshing state... [id=rtbassoc-019686ce1b7172f8e]
aws_elasticache_subnet_group.elasticache_subnet: Refreshing state... [id=app-4-cache-subnet]
aws_security_group_rule.ec2_instance_egress: Refreshing state... [id=sgrule-2308173889]
aws_security_group_rule.ec2_instance_ingress: Refreshing state... [id=sgrule-454067385]
aws_elasticache_replication_group.app4: Refreshing state... [id=app-4]
aws_ssm_parameter.elasticache_port: Refreshing state... [id=/elasticache/app-4/app-4/port]
aws_ssm_parameter.elasticache_ep: Refreshing state... [id=/elasticache/app-4/app-4/endpoint]
aws_iam_policy.ssm_parameter_policy: Refreshing state... [id=arn:aws:iam::743794601996:policy/app-4-ssm-parameter-read-policy]
aws_instance.app-server-read: Refreshing state... [id=i-0754786f37815b5c0]
aws_instance.app-server-write: Refreshing state... [id=i-03de8045f8a1bda92]
aws_iam_role_policy_attachment.ssm_policy_attachement: Refreshing state... [id=app-4-ec2-role-20241118214417729500000006]

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

Terraform will perform the following actions:

  # aws_instance.app-server-read will be updated in-place
  ~ resource "aws_instance" "app-server-read" {
        id                                   = "i-0754786f37815b5c0"
        tags                                 = {
            "Name" = "app-4-server-read"
        }
      ~ user_data                            = "402d9a3b0a1d5894064e74a863aea67a35ce9145" -> "cdd37831a5343289f1bc1e73065f768466cc051f"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

  # aws_instance.app-server-write will be updated in-place
  ~ resource "aws_instance" "app-server-write" {
        id                                   = "i-03de8045f8a1bda92"
        tags                                 = {
            "Name" = "app-4-server-write"
        }
      ~ user_data                            = "3f1fef94fa58c914e69f022f48d708684af4dc53" -> "05195464c01b3b1d7b58f1a079b202e26ee46c6a"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

Plan: 0 to add, 2 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

Copy link
Contributor

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan

terraform
random_password.auth: Refreshing state... [id=none]
module.vpc.aws_vpc.this: Refreshing state... [id=vpc-0eda41e1d4acb30a0]
data.aws_caller_identity.current: Reading...
module.vpc.data.aws_caller_identity.current: Reading...
module.vpc.data.aws_iam_policy_document.assume_role: Reading...
data.aws_ami.amazon_ami: Reading...
aws_iam_role.ec2_role: Refreshing state... [id=app-4-ec2-role]
module.vpc.aws_kms_key.custom_kms_key[0]: Refreshing state... [id=db92469c-1549-4621-a376-47c3ce70cf4e]
aws_kms_key.encryption_secret: Refreshing state... [id=739b15af-9806-403d-88b3-2f1cd20bbba7]
module.vpc.data.aws_availability_zones.available: Reading...
module.vpc.data.aws_iam_policy_document.assume_role: Read complete after 0s [id=2717921857]
aws_kms_key.encryption_rest: Refreshing state... [id=c54ba30e-d0f8-4c69-99f9-a41ad1960b25]
module.vpc.aws_iam_role.vpc_flow_log_role[0]: Refreshing state... [id=app-4-vpc-flow-role]
module.vpc.data.aws_availability_zones.available: Read complete after 0s [id=us-east-2]
module.vpc.data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
data.aws_caller_identity.current: Read complete after 0s [id=743794601996]
aws_kms_key_policy.encryption_secret_policy: Refreshing state... [id=739b15af-9806-403d-88b3-2f1cd20bbba7]
aws_secretsmanager_secret.elasticache_auth: Refreshing state... [id=arn:aws:secretsmanager:us-east-2:743794601996:secret:app-4-elasticache-auth-XDfYTm]
aws_kms_alias.encryption_secret: Refreshing state... [id=alias/app-4-encryption-secret]
module.vpc.aws_kms_alias.key[0]: Refreshing state... [id=alias/app-4]
module.vpc.aws_kms_key_policy.encrypt_log[0]: Refreshing state... [id=db92469c-1549-4621-a376-47c3ce70cf4e]
module.vpc.aws_cloudwatch_log_group.network_flow_logging[0]: Refreshing state... [id=app-4-flow-logs]
aws_cloudwatch_log_group.engine_log: Refreshing state... [id=/elasticache/app-4/engine-log]
aws_kms_alias.encryption_rest: Refreshing state... [id=alias/app-4-encryption-rest]
aws_cloudwatch_log_group.slow_log: Refreshing state... [id=/elasticache/app-4/slow-log]
aws_kms_key_policy.encryption_rest_policy: Refreshing state... [id=c54ba30e-d0f8-4c69-99f9-a41ad1960b25]
aws_secretsmanager_secret_version.auth: Refreshing state... [id=arn:aws:secretsmanager:us-east-2:743794601996:secret:app-4-elasticache-auth-XDfYTm|EF916D7A-C981-433B-A0B5-71A108A38415]
aws_iam_policy.secret_manager_policy: Refreshing state... [id=arn:aws:iam::743794601996:policy/app-4-secret-read-policy]
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Reading...
module.vpc.data.aws_iam_policy_document.vpc_flow_log_policy_document[0]: Read complete after 0s [id=3531817074]
aws_iam_role_policy_attachment.custom: Refreshing state... [id=app-4-ec2-role-20241118213130709800000001]
aws_iam_instance_profile.ec2_profile: Refreshing state... [id=app-4-ec2-profile]
module.vpc.aws_iam_role_policy.vpc_flow_log_role_policy[0]: Refreshing state... [id=app-4-vpc-flow-role:app-4-vpc-flow-policy]
data.aws_ami.amazon_ami: Read complete after 0s [id=ami-0ec5c7d8262c1f6b2]
aws_iam_role_policy_attachment.secret_policy_attachement: Refreshing state... [id=app-4-ec2-role-20241118213140146900000002]
module.vpc.aws_default_security_group.default: Refreshing state... [id=sg-0ff24486bc390b0b2]
module.vpc.aws_route_table.public: Refreshing state... [id=rtb-0da6d9727076537b3]
module.vpc.aws_subnet.private[1]: Refreshing state... [id=subnet-0e64918e1dbb85a32]
module.vpc.aws_subnet.private[0]: Refreshing state... [id=subnet-04fbc3644652e06d8]
module.vpc.aws_flow_log.network_flow_logging[0]: Refreshing state... [id=fl-0db24eee845fdc949]
module.vpc.aws_subnet.public[0]: Refreshing state... [id=subnet-0ca7a2d909fbc14c4]
module.vpc.aws_subnet.private[2]: Refreshing state... [id=subnet-004e4c7774e46164d]
aws_security_group.elasticache: Refreshing state... [id=sg-0f81d7d37df9dc150]
module.vpc.aws_route_table.private[0]: Refreshing state... [id=rtb-09e8e540278140013]
module.vpc.aws_route_table.private[1]: Refreshing state... [id=rtb-01b396b6c391b876f]
module.vpc.aws_route_table.private[2]: Refreshing state... [id=rtb-0aa1df9aea6f4ad04]
module.vpc.aws_internet_gateway.this_igw[0]: Refreshing state... [id=igw-0bd8d6cf40d4dba2a]
aws_security_group.ec2_instance: Refreshing state... [id=sg-0d127b38a829339ef]
aws_elasticache_subnet_group.elasticache_subnet: Refreshing state... [id=app-4-cache-subnet]
module.vpc.aws_route_table_association.public[0]: Refreshing state... [id=rtbassoc-0bbc9788b691bde37]
module.vpc.aws_route_table_association.private[0]: Refreshing state... [id=rtbassoc-019686ce1b7172f8e]
module.vpc.aws_route_table_association.private[2]: Refreshing state... [id=rtbassoc-07b0238a2c23b1a29]
module.vpc.aws_route_table_association.private[1]: Refreshing state... [id=rtbassoc-06bbf4b1bcca3593d]
module.vpc.aws_route.internet_route[0]: Refreshing state... [id=r-rtb-0da6d9727076537b31080289494]
aws_security_group_rule.elasticache_ingress: Refreshing state... [id=sgrule-2581578492]
aws_security_group_rule.elasticache_egress: Refreshing state... [id=sgrule-3098933277]
aws_security_group_rule.ec2_instance_egress: Refreshing state... [id=sgrule-2308173889]
aws_security_group_rule.ec2_instance_ingress: Refreshing state... [id=sgrule-454067385]
aws_elasticache_replication_group.app4: Refreshing state... [id=app-4]
aws_ssm_parameter.elasticache_ep: Refreshing state... [id=/elasticache/app-4/app-4/endpoint]
aws_ssm_parameter.elasticache_port: Refreshing state... [id=/elasticache/app-4/app-4/port]
aws_iam_policy.ssm_parameter_policy: Refreshing state... [id=arn:aws:iam::743794601996:policy/app-4-ssm-parameter-read-policy]
aws_instance.app-server-read: Refreshing state... [id=i-0754786f37815b5c0]
aws_instance.app-server-write: Refreshing state... [id=i-03de8045f8a1bda92]
aws_iam_role_policy_attachment.ssm_policy_attachement: Refreshing state... [id=app-4-ec2-role-20241118214417729500000006]

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

Terraform will perform the following actions:

  # aws_instance.app-server-read will be updated in-place
  ~ resource "aws_instance" "app-server-read" {
        id                                   = "i-0754786f37815b5c0"
        tags                                 = {
            "Name" = "app-4-server-read"
        }
      ~ user_data                            = "402d9a3b0a1d5894064e74a863aea67a35ce9145" -> "cdd37831a5343289f1bc1e73065f768466cc051f"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

  # aws_instance.app-server-write will be updated in-place
  ~ resource "aws_instance" "app-server-write" {
        id                                   = "i-03de8045f8a1bda92"
        tags                                 = {
            "Name" = "app-4-server-write"
        }
      ~ user_data                            = "3f1fef94fa58c914e69f022f48d708684af4dc53" -> "05195464c01b3b1d7b58f1a079b202e26ee46c6a"
        # (39 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }

Plan: 0 to add, 2 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

@kunduso kunduso merged commit 6bdc4e9 into main Nov 19, 2024
6 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 terraform docs automation Create KMS Key policy Enable VPC Flow logs
1 participant