1

I am working on creating an AWS account using Terraform.

I used Terraform resource (aws_organizations_account) to create an AWS account within the organization.

This code creates the account within the organization i specify with no issues however it asks for credit card information upon logging in. I also want to to be able to link this as child account which will tie to parent account`s credit card information.

resource "aws_organizations_account" "dev" {
  name  = "example-dev"
  email = "validemailtest@testdomain.com"
  close_on_deletion = true 
  
  iam_user_access_to_billing = "ALLOW"


  parent_id = aws_organizations_organizational_unit.dev.id
}

How can i make that happen with terraform without any manual work?

edit: I was able to create account and login without credit card but now when i try to destroy using terraform i get below error.

 Error: deleting AWS Organizations Account (#######): ConstraintViolationException: The member account must be configured with a valid payment method, such as a credit card.
│ {
│   RespMetadata: {
│     StatusCode: 400,
│     RequestID: "bfaee9fb-a537-4eeb-9935-53a4bab10cf1"
│   },
│   Message_: "The member account must be configured with a valid payment method, such as a credit card.",
│   Reason: "MEMBER_ACCOUNT_PAYMENT_INSTRUMENT_REQUIRED"
│ }

Is there a way to bypass this when deleting a child account with terraform?

Thanks.

gklucard
  • 15
  • 6

0 Answers0