File tree 2 files changed +40
-6
lines changed
2 files changed +40
-6
lines changed Original file line number Diff line number Diff line change @@ -71,23 +71,26 @@ Here is an example of using this module:
71
71
72
72
## Providers
73
73
74
- | Name | Version |
75
- | ------------------------------------------------------------------ | --------- |
76
- | <a name =" provider_tailscale " ></a > [ tailscale] ( #provider_tailscale ) | >= 0.13.7 |
74
+ | Name | Version |
75
+ | ------------------------------------------------------------------ | ------- |
76
+ | <a name =" provider_aws " ></a > [ aws] ( #provider_aws ) | 5.76.0 |
77
+ | <a name =" provider_tailscale " ></a > [ tailscale] ( #provider_tailscale ) | 0.17.2 |
77
78
78
79
## Modules
79
80
80
81
| Name | Source | Version |
81
82
| -------------------------------------------------------------------------------------------------------- | ---------------------------------- | ------- |
83
+ | <a name =" module_ssm_policy " ></a > [ ssm_policy] ( #module_ssm_policy ) | cloudposse/iam-policy/aws | 2.0.1 |
82
84
| <a name =" module_ssm_state " ></a > [ ssm_state] ( #module_ssm_state ) | cloudposse/ssm-parameter-store/aws | 0.13.0 |
83
85
| <a name =" module_tailscale_subnet_router " ></a > [ tailscale_subnet_router] ( #module_tailscale_subnet_router ) | masterpointio/ssm-agent/aws | 1.2.0 |
84
86
| <a name =" module_this " ></a > [ this] ( #module_this ) | cloudposse/label/null | 0.25.0 |
85
87
86
88
## Resources
87
89
88
- | Name | Type |
89
- | ------------------------------------------------------------------------------------------------------------------------------ | -------- |
90
- | [ tailscale_tailnet_key.default] ( https://registry.terraform.io/providers/tailscale/tailscale/latest/docs/resources/tailnet_key ) | resource |
90
+ | Name | Type |
91
+ | ------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
92
+ | [ aws_iam_role_policy_attachment.default] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment ) | resource |
93
+ | [ tailscale_tailnet_key.default] ( https://registry.terraform.io/providers/tailscale/tailscale/latest/docs/resources/tailnet_key ) | resource |
91
94
92
95
## Inputs
93
96
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ locals {
14
14
15
15
tailscale_up_extra_flags_enabled = length (var. tailscale_up_extra_flags ) > 0
16
16
17
+ additional_policies = length (try (module. ssm_policy [0 ]. arn , [])) > 0 ? [module . ssm_policy [0 ]. arn ] : []
18
+
17
19
userdata = templatefile (" ${ path . module } /userdata.sh.tmpl" , {
18
20
authkey = tailscale_tailnet_key.default.key
19
21
exit_node_enabled = var.exit_node_enabled
@@ -90,3 +92,32 @@ module "ssm_state" {
90
92
context = module. this . context
91
93
tags = module. this . tags
92
94
}
95
+
96
+ module "ssm_policy" {
97
+ count = var. ssm_state_enabled ? 1 : 0
98
+ source = " cloudposse/iam-policy/aws"
99
+ version = " 2.0.1"
100
+
101
+ name = " ssm"
102
+ description = " Additional SSM access for SSM Agent"
103
+ iam_policy = [{
104
+ statements = [
105
+ {
106
+ sid = " SSMAgentPutParameter"
107
+ effect = " Allow"
108
+ actions = [" ssm:PutParameter" ]
109
+ resources = [
110
+ module.ssm_state[0 ].arn_map[local.ssm_state_param_name],
111
+ ]
112
+ },
113
+ ]
114
+ }]
115
+ context = module. this . context
116
+ tags = module. this . tags
117
+ }
118
+
119
+ resource "aws_iam_role_policy_attachment" "default" {
120
+ for_each = toset (local. additional_policies )
121
+ role = module. tailscale_subnet_router . role_id
122
+ policy_arn = each. value
123
+ }
You can’t perform that action at this time.
0 commit comments