Skip to content

Terraform EC2 setup#13

Merged
ongeziwe17 merged 5 commits into
developfrom
tf-ec2-ssh-elastic-ip-setup
Nov 12, 2025
Merged

Terraform EC2 setup#13
ongeziwe17 merged 5 commits into
developfrom
tf-ec2-ssh-elastic-ip-setup

Conversation

@ongeziwe17

Copy link
Copy Markdown
Owner
  1. Fix ssh key re-create same key issue for 2 envs, instead re-use
  2. Each environment (development, staging, production) runs only when its matching branch is pushed

@github-actions

Copy link
Copy Markdown

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_eip.dev_app will be created

  • resource "aws_eip" "dev_app" {
    • allocation_id = (known after apply)
    • arn = (known after apply)
    • association_id = (known after apply)
    • carrier_ip = (known after apply)
    • customer_owned_ip = (known after apply)
    • domain = "vpc"
    • id = (known after apply)
    • instance = (known after apply)
    • ipam_pool_id = (known after apply)
    • network_border_group = (known after apply)
    • network_interface = (known after apply)
    • private_dns = (known after apply)
    • private_ip = (known after apply)
    • ptr_record = (known after apply)
    • public_dns = (known after apply)
    • public_ip = (known after apply)
    • public_ipv4_pool = (known after apply)
    • tags = {
      • "Name" = "ff-dev-frontend-eip"
        }
    • tags_all = {
      • "Name" = "ff-dev-frontend-eip"
        }
    • vpc = (known after apply)
      }

module.compute.aws_instance.app_server will be created

  • resource "aws_instance" "app_server" {
    • ami = "ami-0e6bc8e2e1bbfafb0"

    • arn = (known after apply)

    • associate_public_ip_address = true

    • availability_zone = (known after apply)

    • cpu_core_count = (known after apply)

    • cpu_threads_per_core = (known after apply)

    • disable_api_stop = (known after apply)

    • disable_api_termination = (known after apply)

    • ebs_optimized = (known after apply)

    • enable_primary_ipv6 = (known after apply)

    • get_password_data = false

    • host_id = (known after apply)

    • host_resource_group_arn = (known after apply)

    • iam_instance_profile = "ff-dev-frontend-ec2-profile"

    • id = (known after apply)

    • instance_initiated_shutdown_behavior = (known after apply)

    • instance_lifecycle = (known after apply)

    • instance_state = (known after apply)

    • instance_type = "t3.small"

    • ipv6_address_count = (known after apply)

    • ipv6_addresses = (known after apply)

    • key_name = "ff-dev-admin"

    • monitoring = (known after apply)

    • outpost_arn = (known after apply)

    • password_data = (known after apply)

    • placement_group = (known after apply)

    • placement_partition_number = (known after apply)

    • primary_network_interface_id = (known after apply)

    • private_dns = (known after apply)

    • private_ip = (known after apply)

    • public_dns = (known after apply)

    • public_ip = (known after apply)

    • secondary_private_ips = (known after apply)

    • security_groups = (known after apply)

    • source_dest_check = true

    • spot_instance_request_id = (known after apply)

    • subnet_id = "subnet-01ff2554b6f43721c"

    • tags = {

      • "Environment" = "development"
      • "ManagedBy" = "Terraform"
      • "Name" = "ff-dev-frontend-server"
        }
    • tags_all = {

      • "Environment" = "development"
      • "ManagedBy" = "Terraform"
      • "Name" = "ff-dev-frontend-server"
        }
    • tenancy = (known after apply)

    • user_data = "f256ef0950ce8a0ed3074eb9844b69836ad655b6"

    • user_data_base64 = (known after apply)

    • user_data_replace_on_change = false

    • vpc_security_group_ids = [

      • "sg-0594ba50f19140d1a",
        ]
    • capacity_reservation_specification (known after apply)

    • cpu_options (known after apply)

    • ebs_block_device (known after apply)

    • enclave_options (known after apply)

    • ephemeral_block_device (known after apply)

    • instance_market_options (known after apply)

    • maintenance_options (known after apply)

    • metadata_options (known after apply)

    • network_interface (known after apply)

    • private_dns_name_options (known after apply)

    • root_block_device (known after apply)
      }

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

Changes to Outputs:

  • dev_frontend_elastic_ip = (known after apply)
  • dev_frontend_instance_public_ip = (known after apply)

@github-actions

Copy link
Copy Markdown

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

module.compute.aws_instance.app_server has changed

~ resource "aws_instance" "app_server" {
id = "i-062a7e74902482aa7"
~ public_ip = "16.28.59.172" -> "15.240.23.115"
tags = {
"Environment" = "development"
"ManagedBy" = "Terraform"
"Name" = "ff-dev-server"
}
# (39 unchanged attributes hidden)

    # (8 unchanged blocks hidden)
}

Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.

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

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:

module.compute.aws_instance.app_server will be updated in-place

~ resource "aws_instance" "app_server" {
id = "i-062a7e74902482aa7"
~ public_dns = "ec2-15-240-23-115.af-south-1.compute.amazonaws.com" -> (known after apply)
~ public_ip = "15.240.23.115" -> (known after apply)
tags = {
"Environment" = "development"
"ManagedBy" = "Terraform"
"Name" = "ff-dev-server"
}
~ user_data = "103fabb076dcb45b40f4c911bc10ecad483d51c3" -> "f256ef0950ce8a0ed3074eb9844b69836ad655b6"
# (37 unchanged attributes hidden)

    # (8 unchanged blocks hidden)
}

module.compute.aws_key_pair.dev_admin has moved to module.compute.aws_key_pair.dev_admin[0]

resource "aws_key_pair" "dev_admin" {
    id              = "ff-dev-admin"
    tags            = {
        "Environment" = "development"
        "ManagedBy"   = "Terraform"
        "Name"        = "ff-dev-admin"
    }
    # (8 unchanged attributes hidden)
}

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

Changes to Outputs:
~ dev_backend_instance_public_ip = "16.28.59.172" -> (known after apply)

@ongeziwe17 ongeziwe17 merged commit ad006ea into develop Nov 12, 2025
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.

1 participant