diff --git a/CHANGELOG.md b/CHANGELOG.md index c03df1a..12c31db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,3 +85,8 @@ * 1.6.1 -- 2026-03-25 - policies/sc-servicecatalog-t2 - granted select ec2 permissions + +* 1.7.0 -- 2026-03-25 + - created policies + - policies/sc-operator + diff --git a/common/version.tf b/common/version.tf index 78e6e8d..d16c54d 100644 --- a/common/version.tf +++ b/common/version.tf @@ -1,3 +1,3 @@ locals { - _module_version = "1.6.1" + _module_version = "1.7.0" } diff --git a/policies/sc-operator/README.md b/policies/sc-operator/README.md new file mode 100644 index 0000000..33cb3c2 --- /dev/null +++ b/policies/sc-operator/README.md @@ -0,0 +1,44 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.12 | +| [aws](#requirement\_aws) | >= 6.0 | + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | >= 6.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_arn.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source | +| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_iam_policy_document.inline](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [account\_alias](#input\_account\_alias) | AWS Account Alias | `string` | `""` | no | +| [account\_id](#input\_account\_id) | AWS Account ID (default will pull from current user) | `string` | `""` | no | +| [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | +| [tags](#input\_tags) | AWS Tags to apply to appropriate resources | `map(string)` | `{}` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [customer\_managed\_policy\_names](#output\_customer\_managed\_policy\_names) | Map of policy name to permission boundary of Customer Managed Policy to attach to the permissionset | +| [inline\_policy](#output\_inline\_policy) | AWS Policy document for the single allowed inline policy (use .json to get policy) | +| [managed\_policy\_names](#output\_managed\_policy\_names) | Names of AWS Managed Policy to attach to the permissionset | +| [name](#output\_name) | Permission Set Name for which all settings apply | +| [relay\_state](#output\_relay\_state) | Relay State to pass along to permissionset | diff --git a/policies/sc-operator/base_arn.tf b/policies/sc-operator/base_arn.tf new file mode 100644 index 0000000..5eba500 --- /dev/null +++ b/policies/sc-operator/base_arn.tf @@ -0,0 +1,3 @@ +locals { + all_account_arn_iam = format("arn:%v:%v::%v:%%v", data.aws_arn.current.partition, "iam", "*") +} diff --git a/policies/sc-operator/data.tf b/policies/sc-operator/data.tf new file mode 120000 index 0000000..37fff16 --- /dev/null +++ b/policies/sc-operator/data.tf @@ -0,0 +1 @@ +../../common/data.tf \ No newline at end of file diff --git a/policies/sc-operator/defaults.tf b/policies/sc-operator/defaults.tf new file mode 120000 index 0000000..1227df3 --- /dev/null +++ b/policies/sc-operator/defaults.tf @@ -0,0 +1 @@ +../../common/defaults.tf \ No newline at end of file diff --git a/policies/sc-operator/locals.tf b/policies/sc-operator/locals.tf new file mode 100644 index 0000000..6aa29cd --- /dev/null +++ b/policies/sc-operator/locals.tf @@ -0,0 +1,12 @@ +locals { + account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id + account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew" + region = data.aws_region.current.region + region_short = join("", [for c in split("-", local.region) : substr(c, 0, 1)]) + + base_tags = { + "boc:tf_module_version" = local._module_version + "boc:tf_module_name" = local._module_name + "boc:created_by" = "terraform" + } +} diff --git a/policies/sc-operator/main.tf b/policies/sc-operator/main.tf new file mode 100644 index 0000000..3c91f4a --- /dev/null +++ b/policies/sc-operator/main.tf @@ -0,0 +1,2 @@ +/* +*/ diff --git a/policies/sc-operator/module_name.tf b/policies/sc-operator/module_name.tf new file mode 100644 index 0000000..d48cd32 --- /dev/null +++ b/policies/sc-operator/module_name.tf @@ -0,0 +1,3 @@ +locals { + _module_name = "aws-sso/policies/sc-operator" +} diff --git a/policies/sc-operator/outputs.tf b/policies/sc-operator/outputs.tf new file mode 100644 index 0000000..776869b --- /dev/null +++ b/policies/sc-operator/outputs.tf @@ -0,0 +1,24 @@ +output "name" { + description = "Permission Set Name for which all settings apply" + value = local.name +} + +output "managed_policy_names" { + description = "Names of AWS Managed Policy to attach to the permissionset" + value = local.managed_policy_names +} + +output "customer_managed_policy_names" { + description = "Map of policy name to permission boundary of Customer Managed Policy to attach to the permissionset" + value = local.customer_managed_policy_names +} + +output "inline_policy" { + description = "AWS Policy document for the single allowed inline policy (use .json to get policy)" + value = local.inline_policy +} + +output "relay_state" { + description = "Relay State to pass along to permissionset" + value = local.relay_state +} diff --git a/policies/sc-operator/policy.tf b/policies/sc-operator/policy.tf new file mode 100644 index 0000000..ef3100f --- /dev/null +++ b/policies/sc-operator/policy.tf @@ -0,0 +1,18 @@ +data "aws_iam_policy_document" "inline" { + statement { + sid = "DenyGetAccessToData" + effect = "Deny" + resources = ["*"] + + actions = [ + "sqs:Receive*", + "s3:GetObject*", + "dynamodb:Scan", + "dynamodb:Query", + "dynamodb:Get*", + "dynamodb:BatchGet*", + "athena:Get*", + "athena:Batch*", + ] + } +} diff --git a/policies/sc-operator/prefixes.tf b/policies/sc-operator/prefixes.tf new file mode 120000 index 0000000..5bc256c --- /dev/null +++ b/policies/sc-operator/prefixes.tf @@ -0,0 +1 @@ +../../common/prefixes.tf \ No newline at end of file diff --git a/policies/sc-operator/settings.tf b/policies/sc-operator/settings.tf new file mode 100644 index 0000000..85d0a71 --- /dev/null +++ b/policies/sc-operator/settings.tf @@ -0,0 +1,11 @@ +locals { + name = "sc-operator" + description = "System Common Opeerator" + managed_policy_names = [ + "IAMReadOnlyAccess", + "ReadOnlyAccess", + ] + customer_managed_policy_names = {} + # relay_state = data.aws_arn.current.partition == "aws-us-gov" ? "https://console.amazonaws-us-gov.com/X/home" : "https://console.aws.amazon.com/X/home" + inline_policy = data.aws_iam_policy_document.inline +} diff --git a/policies/sc-operator/variables.common.tf b/policies/sc-operator/variables.common.tf new file mode 120000 index 0000000..e01226c --- /dev/null +++ b/policies/sc-operator/variables.common.tf @@ -0,0 +1 @@ +../../common/variables.common.tf \ No newline at end of file diff --git a/policies/sc-operator/version.tf b/policies/sc-operator/version.tf new file mode 120000 index 0000000..4950c91 --- /dev/null +++ b/policies/sc-operator/version.tf @@ -0,0 +1 @@ +../../common/version.tf \ No newline at end of file diff --git a/policies/sc-operator/versions.tf b/policies/sc-operator/versions.tf new file mode 120000 index 0000000..cbeda73 --- /dev/null +++ b/policies/sc-operator/versions.tf @@ -0,0 +1 @@ +../../common/versions.tf \ No newline at end of file