Code Monkey home page Code Monkey logo

Comments (8)

fculpo avatar fculpo commented on June 12, 2024 1

@nozaq Hi, no I didn't use Security Hub before.
Actually your module seems to activate it with the first call, andd all subsequent enabled regions fail with the above error.

from terraform-aws-secure-baseline.

fculpo avatar fculpo commented on June 12, 2024 1

I applied region per region, deleting manually inthe AWS console until all regions were ok.
Seems fine now.

from terraform-aws-secure-baseline.

nozaq avatar nozaq commented on June 12, 2024

@fculpo Hi, have you already enabled SecurityHub outside of this module? If so, manually importing those subscription would resolve the error.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/securityhub_account#import

from terraform-aws-secure-baseline.

nozaq avatar nozaq commented on June 12, 2024

@fculpo Hmm, I see.
Could you check if each of the providers passed to the module(aws.ap-northeast-1, aws.us-east-1, etc.) has a region specified correctly? The module tries to enable SecurityHub for each provider, ResourceConflictException would happen when some of them point to the same region (also the default region would be used if no region was specified).

from terraform-aws-secure-baseline.

fculpo avatar fculpo commented on June 12, 2024

@nozaq Hi, here is the provider config:

I don't see any duplicates and each provider is mapped onto your required ones.

provider "aws" {
  region              = "eu-west-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ap-southeast-1"
  alias               = "ap-southeast-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ap-southeast-2"
  alias               = "ap-southeast-2"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "sa-east-1"
  alias               = "sa-east-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ap-northeast-1"
  alias               = "ap-northeast-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ap-northeast-2"
  alias               = "ap-northeast-2"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ap-northeast-3"
  alias               = "ap-northeast-3"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ap-south-1"
  alias               = "ap-south-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "us-east-1"
  alias               = "us-east-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "us-east-2"
  alias               = "us-east-2"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "ca-central-1"
  alias               = "ca-central-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "eu-north-1"
  alias               = "eu-north-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "eu-west-1"
  alias               = "eu-west-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "eu-west-2"
  alias               = "eu-west-2"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "eu-west-3"
  alias               = "eu-west-3"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "us-west-1"
  alias               = "us-west-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "us-west-2"
  alias               = "us-west-2"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

provider "aws" {
  region              = "eu-central-1"
  alias               = "eu-central-1"
  allowed_account_ids = local.allowed_account_ids
  profile             = local.profile
}

from terraform-aws-secure-baseline.

fculpo avatar fculpo commented on June 12, 2024

Hi @nozaq, any news on this ?

from terraform-aws-secure-baseline.

jericoagustin avatar jericoagustin commented on June 12, 2024

@fculpo ,

How did you exactly resolved this?

I think I'm experiencing the same thing and encountering this error

Im using
hashicorp/aws version = "5.1.0"


│ Error: creating Security Hub Account: ResourceConflictException: Account is already subscribed to Security Hub
│ {
│   RespMetadata: {
│     StatusCode: 401,
│     RequestID: "d0100de1-5143-4ba0-bb8e-b64663838e83"
│   },
│   Code_: "ResourceConflictException",
│   Message_: "Account is already subscribed to Security Hub"
│ }

I tried to look at the aws console one by one on each region but Security Hub wasn't enabled in any of the regions.

I was able to create it at first then did the terraform destroy, but after running it the next day, it showing the error above.

from terraform-aws-secure-baseline.

fculpo avatar fculpo commented on June 12, 2024

I'm not sure we did resolve it, and not using this module anymore afaik

from terraform-aws-secure-baseline.

Related Issues (20)

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.