Skip to content

refactor(iac)!: Restructure into environments and modules#101

Merged
chris3ware merged 9 commits intomainfrom
ref-env-mod
Apr 7, 2025
Merged

refactor(iac)!: Restructure into environments and modules#101
chris3ware merged 9 commits intomainfrom
ref-env-mod

Conversation

@chris3ware
Copy link
Copy Markdown
Member

To reduce code duplication the old development environment has been moved into the modules directory.

Each new environment directory will call the new 'gitops-2024' module.

@chris3ware chris3ware requested a review from a team as a code owner April 4, 2025 12:13
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2025

tofu plan -chdir=iac/environments/dev
Diff of 10 changes.
+ module.gitops_2024.aws_default_security_group.default will be created
+ module.gitops_2024.aws_instance.grafana_server will be created
+ module.gitops_2024.aws_internet_gateway.gitops_igw will be created
+ module.gitops_2024.aws_route_table.gitops_rt will be created
+ module.gitops_2024.aws_route_table_association.gitops_rta will be created
+ module.gitops_2024.aws_security_group.grafana_sg will be created
+ module.gitops_2024.aws_subnet.gitops_subnet will be created
+ module.gitops_2024.aws_vpc.gitops_vpc will be created
+ module.gitops_2024.aws_vpc_security_group_egress_rule.grafana_egress will be created
+ module.gitops_2024.aws_vpc_security_group_ingress_rule.grafana_ingress will be created
Plan: 10 to add, 0 to change, 0 to destroy.
By @chris3ware at 2025-04-07T13:42:38Z (view log).
OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

OpenTofu will perform the following actions:

  # module.gitops_2024.aws_default_security_group.default will be created
  + resource "aws_default_security_group" "default" {
      + arn                    = (known after apply)
      + description            = (known after apply)
      + egress                 = (known after apply)
      + id                     = (known after apply)
      + ingress                = (known after apply)
      + name                   = (known after apply)
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags_all               = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
        }
      + vpc_id                 = (known after apply)
    }

  # module.gitops_2024.aws_instance.grafana_server will be created
  + resource "aws_instance" "grafana_server" {
      + ami                                  = "ami-0fef583e486727263"
      + arn                                  = (known after apply)
      + associate_public_ip_address          = (known after apply)
      + 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                 = (known after apply)
      + id                                   = (known after apply)
      + instance_initiated_shutdown_behavior = (known after apply)
      + instance_lifecycle                   = (known after apply)
      + instance_state                       = (known after apply)
      + instance_type                        = "t2.micro"
      + ipv6_address_count                   = (known after apply)
      + ipv6_addresses                       = (known after apply)
      + key_name                             = (known after apply)
      + 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                            = (known after apply)
      + tags                                 = {
          + "Name" = "grafana-server-development"
        }
      + tags_all                             = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "grafana-server-development"
        }
      + tenancy                              = (known after apply)
      + user_data                            = "829fb476176e8de655d5449a8790a17650f3af0e"
      + user_data_base64                     = (known after apply)
      + user_data_replace_on_change          = false
      + vpc_security_group_ids               = (known after apply)

      + 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)
    }

  # module.gitops_2024.aws_internet_gateway.gitops_igw will be created
  + resource "aws_internet_gateway" "gitops_igw" {
      + arn      = (known after apply)
      + id       = (known after apply)
      + owner_id = (known after apply)
      + tags     = {
          + "Name" = "gitops-igw-development"
        }
      + tags_all = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "gitops-igw-development"
        }
      + vpc_id   = (known after apply)
    }

  # module.gitops_2024.aws_route_table.gitops_rt will be created
  + resource "aws_route_table" "gitops_rt" {
      + arn              = (known after apply)
      + id               = (known after apply)
      + owner_id         = (known after apply)
      + propagating_vgws = (known after apply)
      + route            = [
          + {
              + carrier_gateway_id         = ""
              + cidr_block                 = "0.0.0.0/0"
              + core_network_arn           = ""
              + destination_prefix_list_id = ""
              + egress_only_gateway_id     = ""
              + gateway_id                 = (known after apply)
              + ipv6_cidr_block            = ""
              + local_gateway_id           = ""
              + nat_gateway_id             = ""
              + network_interface_id       = ""
              + transit_gateway_id         = ""
              + vpc_endpoint_id            = ""
              + vpc_peering_connection_id  = ""
            },
        ]
      + tags             = {
          + "Name" = "gitops-rt-development"
        }
      + tags_all         = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "gitops-rt-development"
        }
      + vpc_id           = (known after apply)
    }

  # module.gitops_2024.aws_route_table_association.gitops_rta will be created
  + resource "aws_route_table_association" "gitops_rta" {
      + id             = (known after apply)
      + route_table_id = (known after apply)
      + subnet_id      = (known after apply)
    }

  # module.gitops_2024.aws_security_group.grafana_sg will be created
  + resource "aws_security_group" "grafana_sg" {
      + arn                    = (known after apply)
      + description            = "Grafana Server security group"
      + egress                 = (known after apply)
      + id                     = (known after apply)
      + ingress                = (known after apply)
      + name                   = "grafana_sg"
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags_all               = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
        }
      + vpc_id                 = (known after apply)
    }

  # module.gitops_2024.aws_subnet.gitops_subnet will be created
  + resource "aws_subnet" "gitops_subnet" {
      + arn                                            = (known after apply)
      + assign_ipv6_address_on_creation                = false
      + availability_zone                              = (known after apply)
      + availability_zone_id                           = (known after apply)
      + cidr_block                                     = "10.0.1.0/24"
      + enable_dns64                                   = false
      + enable_resource_name_dns_a_record_on_launch    = false
      + enable_resource_name_dns_aaaa_record_on_launch = false
      + id                                             = (known after apply)
      + ipv6_cidr_block_association_id                 = (known after apply)
      + ipv6_native                                    = false
      + map_public_ip_on_launch                        = true
      + owner_id                                       = (known after apply)
      + private_dns_hostname_type_on_launch            = (known after apply)
      + tags                                           = {
          + "Name" = "gitops-subnet-development"
        }
      + tags_all                                       = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "gitops-subnet-development"
        }
      + vpc_id                                         = (known after apply)
    }

  # module.gitops_2024.aws_vpc.gitops_vpc will be created
  + resource "aws_vpc" "gitops_vpc" {
      + arn                                  = (known after apply)
      + cidr_block                           = "10.0.0.0/16"
      + default_network_acl_id               = (known after apply)
      + default_route_table_id               = (known after apply)
      + default_security_group_id            = (known after apply)
      + dhcp_options_id                      = (known after apply)
      + enable_dns_hostnames                 = true
      + enable_dns_support                   = true
      + enable_network_address_usage_metrics = (known after apply)
      + id                                   = (known after apply)
      + instance_tenancy                     = "default"
      + ipv6_association_id                  = (known after apply)
      + ipv6_cidr_block                      = (known after apply)
      + ipv6_cidr_block_network_border_group = (known after apply)
      + main_route_table_id                  = (known after apply)
      + owner_id                             = (known after apply)
      + tags                                 = {
          + "Name" = "gitops-vpc-development"
        }
      + tags_all                             = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "gitops-vpc-development"
        }
    }

  # module.gitops_2024.aws_vpc_security_group_egress_rule.grafana_egress will be created
  + resource "aws_vpc_security_group_egress_rule" "grafana_egress" {
      + arn                    = (known after apply)
      + cidr_ipv4              = "0.0.0.0/0"
      + description            = "Outbound traffic from grafana server"
      + id                     = (known after apply)
      + ip_protocol            = "-1"
      + security_group_id      = (known after apply)
      + security_group_rule_id = (known after apply)
      + tags                   = {
          + "Name" = "grafana-egress-sg-rule-development"
        }
      + tags_all               = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "grafana-egress-sg-rule-development"
        }
    }

  # module.gitops_2024.aws_vpc_security_group_ingress_rule.grafana_ingress will be created
  + resource "aws_vpc_security_group_ingress_rule" "grafana_ingress" {
      + arn                    = (known after apply)
      + cidr_ipv4              = "0.0.0.0/0"
      + description            = "Inbound traffic to grafana web interface"
      + from_port              = 3000
      + id                     = (known after apply)
      + ip_protocol            = "tcp"
      + security_group_id      = (known after apply)
      + security_group_rule_id = (known after apply)
      + tags                   = {
          + "Name" = "grafana-ingress-sg-rule-development"
        }
      + tags_all               = {
          + "3ware:environment"          = "development"
          + "3ware:managed-by-terraform" = "true"
          + "3ware:project-id"           = "gitops-2024"
          + "3ware:service"              = "gitops-infra"
          + "3ware:workspace"            = "gitops-infra-eu-west-2-development"
          + "Name"                       = "grafana-ingress-sg-rule-development"
        }
      + to_port                = 3000
    }

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

Changes to Outputs:
  + grafana_ip = (known after apply)

@github-actions github-actions Bot added the tf:plan Pull requests that plan TF code. label Apr 4, 2025
@chris3ware
Copy link
Copy Markdown
Member Author

infracost is currently failing because the iac directory does not exist on the base branch.

@chris3ware chris3ware merged commit 9f38b2b into main Apr 7, 2025
@chris3ware chris3ware deleted the ref-env-mod branch April 7, 2025 13:44
3ware-release Bot pushed a commit that referenced this pull request Apr 7, 2025
## [2.0.0](v1.3.0...v2.0.0) (2025-04-07)

### ⚠ BREAKING CHANGES

* **iac:** Restructure into environments and modules (#101)

### Enhancement

* **iac:** Restructure into environments and modules ([#101](#101)) ([9f38b2b](9f38b2b))
@3ware-release
Copy link
Copy Markdown
Contributor

3ware-release Bot commented Apr 7, 2025

This PR is included in version 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tf:plan Pull requests that plan TF code.

Development

Successfully merging this pull request may close these issues.

1 participant