bincyber / terraform-aws-remote-state Goto Github PK
View Code? Open in Web Editor NEWTerraform module to setup remote state for AWS
License: Apache License 2.0
Terraform module to setup remote state for AWS
License: Apache License 2.0
While trying to run terraform commands as a user attached to the terraform_rw_access group, I was getting:
Error: Error locking state: Error acquiring the state lock: 2 error(s) occurred:
* AccessDeniedException: User: arn:aws:iam::[account_num]:user/[user_name] is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:[region]:[account_num]:table/[table_name]
status code: 400, request id: blahblah
* AccessDeniedException: User: arn:aws:iam::[account_num]:user/[user_name] is not authorized to perform: dynamodb:GetItem on resource: arn:aws:dynamodb:[region]:[account_num]:table/[table_name]
status code: 400, request id: blahblah
I was able to fix it by adding in the account number explicitly:
data "aws_caller_identity" "current" {}
data "aws_iam_policy_document" "dynamodb_table" {
statement {
sid = "AllowRWDynamoDBTable"
effect = "Allow"
actions = [
"dynamodb:DescribeTable",
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:UpdateItem",
"dynamodb:DeleteItem",
]
resources = [
"arn:aws:dynamodb:${var.region}:${data.aws_caller_identity.current.account_id}:table/${local.dynamodb_table_name}",
]
}
}
I'm happy to make a PR with the change is that sounds like a good fix for you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.