narrow down permissions of deploy user policy
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
d7c413255b
commit
c026b8404b
|
@ -25,3 +25,84 @@ resource "aws_iam_group_policy_attachment" "deploy" {
|
||||||
group = aws_iam_group.deploy.name
|
group = aws_iam_group.deploy.name
|
||||||
policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkFullAccess"
|
policy_arn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkFullAccess"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This doesn't work right now, needs improvement */
|
||||||
|
//data "aws_region" "current" {}
|
||||||
|
//data "aws_caller_identity" "current" {}
|
||||||
|
//data "aws_iam_user" "deploy" {
|
||||||
|
// user_name = aws_iam_user.deploy.name
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///* shorthands for neater templating */
|
||||||
|
//locals {
|
||||||
|
// region = data.aws_region.current.name
|
||||||
|
// account_id = data.aws_caller_identity.current.account_id
|
||||||
|
// instance_profile = module.eb_environment.ec2_instance_profile_role_name
|
||||||
|
// full_app_name = "${var.stage}-${local.app_name}"
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///* Source: https://gist.github.com/magnetikonline/5034bdbb049181a96ac9 */
|
||||||
|
//resource "aws_iam_group_policy" "deploy" {
|
||||||
|
// name = "${var.name}-deploy-policy"
|
||||||
|
// group = aws_iam_group.deploy.name
|
||||||
|
//
|
||||||
|
// policy = <<EOF
|
||||||
|
//{
|
||||||
|
// "Version": "2012-10-17",
|
||||||
|
// "Statement": [
|
||||||
|
// {
|
||||||
|
// "Action": [
|
||||||
|
// "autoscaling:*",
|
||||||
|
// "cloudformation:*",
|
||||||
|
// "ec2:*"
|
||||||
|
// ],
|
||||||
|
// "Effect": "Allow",
|
||||||
|
// "Resource": ["*"]
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "Action": ["elasticbeanstalk:CreateStorageLocation"],
|
||||||
|
// "Effect": "Allow",
|
||||||
|
// "Resource": ["*"]
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "Action": ["elasticbeanstalk:*"],
|
||||||
|
// "Effect": "Allow",
|
||||||
|
// "Resource": [
|
||||||
|
// "arn:aws:elasticbeanstalk:*::solutionstack/*",
|
||||||
|
// "arn:aws:elasticbeanstalk:${local.region}:${local.account_id}:application/${local.full_app_name}",
|
||||||
|
// "arn:aws:elasticbeanstalk:${local.region}:${local.account_id}:applicationversion/${local.full_app_name}/*",
|
||||||
|
// "arn:aws:elasticbeanstalk:${local.region}:${local.account_id}:environment/${local.full_app_name}/*",
|
||||||
|
// "arn:aws:elasticbeanstalk:${local.region}:${local.account_id}:template/${local.full_app_name}/*"
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "Action": ["s3:GetObject"],
|
||||||
|
// "Effect": "Allow",
|
||||||
|
// "Resource": ["arn:aws:s3:::elasticbeanstalk-*/*"]
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "Action": [
|
||||||
|
// "s3:CreateBucket",
|
||||||
|
// "s3:DeleteObject",
|
||||||
|
// "s3:GetBucketPolicy",
|
||||||
|
// "s3:GetObjectAcl",
|
||||||
|
// "s3:ListBucket",
|
||||||
|
// "s3:PutBucketPolicy",
|
||||||
|
// "s3:PutObject",
|
||||||
|
// "s3:PutObjectAcl"
|
||||||
|
// ],
|
||||||
|
// "Effect": "Allow",
|
||||||
|
// "Resource": [
|
||||||
|
// "arn:aws:s3:::elasticbeanstalk-${local.region}-${local.account_id}",
|
||||||
|
// "arn:aws:s3:::elasticbeanstalk-${local.region}-${local.account_id}/*"
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "Action": ["iam:PassRole"],
|
||||||
|
// "Effect": "Allow",
|
||||||
|
// "Resource": ["arn:aws:iam::${local.account_id}:role/${local.instance_profile}"]
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
//}
|
||||||
|
//EOF
|
||||||
|
//}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
locals {
|
locals {
|
||||||
fqdn = "${var.stage}.${var.dns_domain}"
|
fqdn = "${var.stage}.${var.dns_domain}"
|
||||||
|
/* also used in deployment user policy */
|
||||||
|
app_name = "${replace(var.dns_domain, ".", "-")}-app"
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_availability_zones" "available" {
|
data "aws_availability_zones" "available" {
|
||||||
|
@ -31,7 +33,7 @@ module "subnets" {
|
||||||
module "eb_application" {
|
module "eb_application" {
|
||||||
source = "git::https://github.com/lodotek/terraform-aws-elastic-beanstalk-application.git?ref=ref-0.12"
|
source = "git::https://github.com/lodotek/terraform-aws-elastic-beanstalk-application.git?ref=ref-0.12"
|
||||||
|
|
||||||
name = "${replace(var.dns_domain, ".", "-")}-app"
|
name = local.app_name
|
||||||
description = "${local.fqdn} application"
|
description = "${local.fqdn} application"
|
||||||
stage = var.stage
|
stage = var.stage
|
||||||
namespace = ""
|
namespace = ""
|
||||||
|
@ -41,7 +43,7 @@ module "eb_environment" {
|
||||||
source = "git::https://github.com/lodotek/terraform-aws-elastic-beanstalk-environment.git?ref=master"
|
source = "git::https://github.com/lodotek/terraform-aws-elastic-beanstalk-environment.git?ref=master"
|
||||||
|
|
||||||
description = "Dapp Discovery Store - ${local.fqdn}"
|
description = "Dapp Discovery Store - ${local.fqdn}"
|
||||||
name = "${replace(var.dns_domain, ".", "-")}-app"
|
name = local.app_name
|
||||||
stage = var.stage
|
stage = var.stage
|
||||||
namespace = ""
|
namespace = ""
|
||||||
solution_stack_name = var.stack_name
|
solution_stack_name = var.stack_name
|
||||||
|
|
Loading…
Reference in New Issue