GithubHelp home page GithubHelp logo

tedilabs / terraform-aws-account Goto Github PK

View Code? Open in Web Editor NEW
45.0 3.0 10.0 382 KB

๐ŸŒณ A sustainable Terraform Package which creates Account & IAM resources on AWS

Home Page: https://registry.terraform.io/modules/tedilabs/account/aws

License: Apache License 2.0

HCL 100.00%
aws devops hacktoberfest hcl2 lang-hcl aws-iam sre terraform-modules terraform-module terraform

terraform-aws-account's People

Contributors

dependabot[bot] avatar murasaki718 avatar posquit0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

terraform-aws-account's Issues

[BUG]: ap-southeast-4 region missing from region module locals

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When attempting to assign a kms key as the default ebs encryption key in the ap-southeast-4 region, I get the following error:

Error: Invalid index

on outputs.tf line 8, in output "code":
8: value = local.region_codes[data.aws_region.this.id]
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚ data.aws_region.this.id is "ap-southeast-4"
โ”‚ local.region_codes is object with 25 attributes

it appears to be due to the referenced locals not including the region provided:
locals {
region = data.aws_region.this.name
region_codes = {
"us-east-1" = "use1"
"us-east-2" = "use2"
"us-west-1" = "usw1"
"us-west-2" = "usw2"
"af-south-1" = "afs1"
"ap-east-1" = "ape1"
"ap-northeast-1" = "apne1"
"ap-northeast-2" = "apne2"
"ap-northeast-3" = "apne3"
"ap-southeast-1" = "apse1"
"ap-southeast-2" = "apse2"
"ap-southeast-3" = "apse3"
"ap-south-1" = "aps1"
"ca-central-1" = "cac1"
"eu-central-1" = "euc1"
"eu-west-1" = "euw1"
"eu-west-2" = "euw2"
"eu-west-3" = "euw3"
"eu-north-1" = "eun1"
"eu-south-1" = "eus1"
"me-south-1" = "mes1"
"sa-east-1" = "sae1"
"cn-north-1" = "cn1"
"us-gov-west-1" = "usgw1"
"us-gov-east-1" = "usge1"
}
}

the output "code" then fails due to the current region not being included in the locals.

output "code" {
description = "The short code of the current region."
value = local.region_codes[data.aws_region.this.id]
}

Steps To Reproduce

Using terragrunt:

terraform {
source = "tfr:///tedilabs/account/aws//modules/region?version=0.30.4"
}

inputs = {
ebs_default_encryption = {
enabled = true
kms_key = ""
}
}

terragrunt run-all plan --terragrunt-non-interactive

data.aws_region.this: Reading...
data.aws_region.this: Read complete after 0s [id=ap-southeast-4]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:

  • create

Terraform planned the following actions, but then encountered a problem:

aws_ebs_default_kms_key.this[0] will be created

  • resource "aws_ebs_default_kms_key" "this" {
    • id = (known after apply)
    • key_arn = "arn:aws:kms:ap-southeast-4:000000000000:key/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
      }

aws_ebs_encryption_by_default.this will be created

  • resource "aws_ebs_encryption_by_default" "this" {
    • enabled = true
    • id = (known after apply)
      }

aws_ec2_image_block_public_access.this will be created

  • resource "aws_ec2_image_block_public_access" "this" {
    • id = (known after apply)
    • state = "block-new-sharing"
      }

aws_ec2_instance_metadata_defaults.this[0] will be created

  • resource "aws_ec2_instance_metadata_defaults" "this" {
    • http_endpoint = "enabled"
    • http_put_response_hop_limit = 1
    • http_tokens = "required"
    • id = (known after apply)
    • instance_metadata_tags = "no-preference"
      }

aws_ec2_serial_console_access.this will be created

  • resource "aws_ec2_serial_console_access" "this" {
    • enabled = false
    • id = (known after apply)
      }

aws_resourceexplorer2_index.this[0] will be created

  • resource "aws_resourceexplorer2_index" "this" {
    • arn = (known after apply)
    • id = (known after apply)
    • tags = {
      • "Name" = "ap-southeast-4"
      • "module.terraform.io/full-name" = "terraform-aws-account/."
      • "module.terraform.io/instance" = "ap-southeast-4"
      • "module.terraform.io/name" = "."
      • "module.terraform.io/package" = "terraform-aws-account"
      • "module.terraform.io/version" = "0.30.4"
        }
    • tags_all = {
      • "Name" = "ap-southeast-4"
      • "module.terraform.io/full-name" = "terraform-aws-account/."
      • "module.terraform.io/instance" = "ap-southeast-4"
      • "module.terraform.io/name" = "."
      • "module.terraform.io/package" = "terraform-aws-account"
      • "module.terraform.io/version" = "0.30.4"
        }
    • type = "LOCAL"
      }

module.resource_group[0].aws_resourcegroups_group.this will be created

  • resource "aws_resourcegroups_group" "this" {
    • arn = (known after apply)

    • description = "Managed by Terraform."

    • id = (known after apply)

    • name = "terraform-aws-account...ap-southeast-4"

    • tags = {

      • "Name" = "terraform-aws-account...ap-southeast-4"
      • "module.terraform.io/full-name" = "terraform-aws-account/."
      • "module.terraform.io/instance" = "ap-southeast-4"
      • "module.terraform.io/name" = "."
      • "module.terraform.io/package" = "terraform-aws-account"
      • "module.terraform.io/version" = "0.30.4"
        }
    • tags_all = {

      • "Name" = "terraform-aws-account...ap-southeast-4"
      • "module.terraform.io/full-name" = "terraform-aws-account/."
      • "module.terraform.io/instance" = "ap-southeast-4"
      • "module.terraform.io/name" = "."
      • "module.terraform.io/package" = "terraform-aws-account"
      • "module.terraform.io/version" = "0.30.4"
        }
    • resource_query {

      • query = jsonencode(
        {
        + ResourceTypeFilters = [
        + "AWS::AllSupported",
        ]
        + TagFilters = [
        + {
        + Key = "module.terraform.io/full-name"
        + Values = [
        + "terraform-aws-account/.",
        ]
        },
        + {
        + Key = "module.terraform.io/instance"
        + Values = [
        + "ap-southeast-4",
        ]
        },
        + {
        + Key = "module.terraform.io/name"
        + Values = [
        + ".",
        ]
        },
        + {
        + Key = "module.terraform.io/package"
        + Values = [
        + "terraform-aws-account",
        ]
        },
        + {
        + Key = "module.terraform.io/version"
        + Values = [
        + "0.30.4",
        ]
        },
        ]
        }
        )
      • type = "TAG_FILTERS_1_0"
        }
        }

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

Changes to Outputs:

  • cloudwdatch = {
    • oam_sink = null
      }
  • description = "Asia Pacific (Melbourne)"
  • ebs = {
    • default_encryption = {
      • enabled = true
      • kms_key = "arn:aws:kms:ap-southeast-4:000000000000:key/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
        }
        }
  • ec2 = {
    • ami_public_access_enabled = false
    • instance_metadata_defaults = {
      • http_enabled = true
      • http_put_response_hop_limit = 1
      • http_token_required = true
      • instance_tags_enabled = null
        }
    • serial_console_enabled = false
      }
  • guardduty = {
    • delegated_administrator = null
      }
  • id = "ap-southeast-4"
  • inspector = {
    • delegated_administrator = null
      }
  • macie = {
    • delegated_administrator = null
      }
  • name = "ap-southeast-4"
  • resource_explorer = {
    • enabled = true
    • index_arn = (known after apply)
    • index_type = "LOCAL"
    • views = {}
      }
  • service_quotas = {}
  • vpc = {
    • availability_zone_groups = {}
      }
      ERRO[0072] Module has finished with an error: 1 error occurred:
      INFO[0072]
      Error: Invalid index

on outputs.tf line 8, in output "code":
8: value = local.region_codes[data.aws_region.this.id]
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”‚ data.aws_region.this.id is "ap-southeast-4"
โ”‚ local.region_codes is object with 25 attributes

The given key does not identify an element in this collection value.

We have two deployment regions (ap-southeast-2 and ap-southeast-4). The ap-southeast-2 region deployments complete successfully.

Which version of the app are you using?

1.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.