Though the console AWS Account > IAM > Account Settings
your able to enable and disable regions
Is there a way to do that through either Boto3 or Terraform ?
Though the console AWS Account > IAM > Account Settings
your able to enable and disable regions
Is there a way to do that through either Boto3 or Terraform ?
That page you are referencing is only for enabling/disabling regional endpoints of the AWS STS service. That doesn't actually disable the use of a region. I can't find any API to manage this setting programatically.
You can enable/disable regions at the account level by logging in as the AWS account administrator and going to My Account -> AWS Regions. However only "opt-in" regions can be enabled or disabled. At this time the only "opt-in" regions are "Middle East (Bahrain)" and "Asia Pacific (Hong Kong)". All other regions are "Enabled by default" on an AWS account and cannot be disabled. Again, I am not aware of an API to manage this setting.
If you want to restrict IAM users from accessing or creating resources in specific regions the correct method of doing this is through IAM policies, per this AWS Blog Post. This of course can be managed through the IAM API.