question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ACCOUNT_ID Override is not working

See original GitHub issue

Moto version’s tried master branch and 3.1.4

@mock_sts
def test_sts_account_override(monkeypatch):
    dummy_account_id = "MEMEMEMEME"
    monkeypatch.setenv("MOTO_ACCOUNT_ID", dummy_account_id)
    os_account_id = os.environ.get("MOTO_ACCOUNT_ID")
    os_account_id.should.equal(dummy_account_id)
    client = boto3.client("sts", region_name="us-west-2")
    resp = client.get_caller_identity()
    resp["Account"].should.equal(dummy_account_id)

this fails.

Expected behavior would be resp[“Account”].should.equal(“MEMEMEMEME”)

This test is being run with pytest. Several other ways to patch env variables have been tried. As seen in the test though the env variable is properly set. That is know bc os_account_id.should.equal(dummy_account_id) passes.

Reporting Bugs

Please be aware of the following things when filing bug reports:

  1. Avoid raising duplicate issues. Please use the GitHub issue search feature to check whether your bug report or feature request has been mentioned in the past.

  2. When filing bug reports about exceptions or tracebacks, please include the complete traceback. Partial tracebacks, or just the exception text, are not helpful.

  3. Make sure you provide a suitable amount of information to work with. This means you should provide:

    • Guidance on how to reproduce the issue. Ideally, this should be a small code sample that can be run immediately by the maintainers. Failing that, let us know what you’re doing, how often it happens, what environment you’re using, etc. Be thorough: it prevents us needing to ask further questions.
    • Tell us what you expected to happen. When we run your example code, what are we expecting to happen? What does “success” look like for your code?
    • Tell us what actually happens. It’s not helpful for you to say “it doesn’t work” or “it fails”. Tell us how it fails: do you get an exception? A hang? How was the actual result different from your expected result?
    • Tell us what version of Moto you’re using, and how you installed it. Tell us whether you’re using standalone server mode or the Python mocks. If you are using the Python mocks, include the version of boto/boto3/botocore.

    If you do not provide all of these things, it will take us much longer to fix your problem.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
bblommerscommented, Aug 20, 2022

Moto 4 is now released, so this now works as you would expect. Please raise a new issue if you still encounter any issues.

0reactions
bblommerscommented, Aug 13, 2022

This feature is now available as of Moto >= 4.0.0.dev3, as part of a broader rework to support multiple accounts - see the documentation here: http://docs.getmoto.org/en/latest/docs/multi_account.html

The full release schedule for Moto 4 can be found here: https://github.com/spulec/moto/issues/5366

Please let us know if you have any feedback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable Overriding of AWS::AccountId psuedo-parameter for ...
I'd like to be able to override the AWS::AccountId pseudo parameter in sam ... I've tested it out locally and it does work...
Read more >
Accountid is not updated when related to custom object is re ...
When we reparent a custom record who has M-D to account, the accountid field on related activities are not updated to the new...
Read more >
Lightning New Case action override
Now, in your custom "New Case" override component (CaseOverride.cmp), you can retrieve the Account ID in the controller or helper like this:
Read more >
How do I get the AccountId as a variable in a serverless.yml file?
If you need those variable as function environment variables, you can overwrite the serverless generated function code with CloudFormation code. So to achieve ......
Read more >
Troubleshoot AWS Config rules that don't work
Resolution. Various issues can cause managed AWS Config rules to not work, including permissions, resource scope, or configuration change items.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found