Skip to content

Commit 4df7772

Browse files
authored
Merge pull request #15 from truefoundry/update-platform-outputs
Update platform outputs
2 parents 181b0d2 + f51d04e commit 4df7772

File tree

4 files changed

+70
-22
lines changed

4 files changed

+70
-22
lines changed

iam.tf

+4-3
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ resource "aws_iam_policy" "truefoundry_platform_feature_cluster_integration_poli
187187

188188
resource "aws_iam_role" "truefoundry_platform_feature_iam_role" {
189189
count = var.platform_feature_enabled ? 1 : 0
190-
name = var.platform_role_enable_override ? var.platform_role_override_name : "${local.truefoundry_unique_name}-iam-role"
191-
description = "IAM role for TrueFoundry to access S3 bucket, SSM and ECR"
190+
name = var.platform_role_enable_override ? var.platform_role_override_name : null
191+
description = "IAM role for TrueFoundry platform to access S3 bucket, SSM, ECR and EKS"
192+
name_prefix = var.platform_role_enable_override ? null : "${local.truefoundry_unique_name}-iam-role-"
192193
force_detach_policies = true
193194
assume_role_policy = jsonencode({
194195
Version = "2012-10-17"
@@ -283,4 +284,4 @@ resource "aws_iam_user_policy_attachment" "truefoundry_platform_user_cluster_int
283284
count = var.platform_feature_enabled ? (var.feature_cluster_integration_enabled && var.platform_user_enabled) ? 1 : 0 : 0
284285
user = aws_iam_user.truefoundry_platform_user[0].name
285286
policy_arn = aws_iam_policy.truefoundry_platform_feature_cluster_integration_policy[0].arn
286-
}
287+
}

output.tf

+53-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
# From https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/outputs.tf
22

33
################################################################################
4-
# User details
4+
# IAM role details
55
################################################################################
6-
7-
output "platform_iam_role_name" {
8-
description = "Then name of the IAM role"
9-
value = var.platform_feature_enabled ? aws_iam_role.truefoundry_platform_feature_iam_role[0].name : ""
10-
}
11-
126
output "platform_iam_role_arn" {
13-
description = "The IAM role resource arn"
7+
description = "The platform IAM role arn"
148
value = var.platform_feature_enabled ? aws_iam_role.truefoundry_platform_feature_iam_role[0].arn : ""
159
}
1610

1711
output "platform_iam_role_assume_role_arns" {
18-
description = "The IAM role arns which has been assume by platform_iam_role"
12+
description = "The role arns that can assume the platform IAM role"
1913
value = var.platform_feature_enabled ? var.control_plane_roles : []
2014
}
2115

2216
output "platform_iam_role_policy_arns" {
23-
description = "The list of ARNs of policies directly assigned to the IAM user"
17+
description = "The platform IAM role policy arns"
2418
value = local.truefoundry_platform_policy_arns
2519
}
2620

21+
output "platform_iam_role_enabled" {
22+
description = "Flag to enable IAM role for the platform. Either this or or `platform_user_enabled` should be enabled"
23+
value = var.platform_feature_enabled
24+
}
25+
26+
################################################################################
27+
# User details
28+
################################################################################
29+
2730
output "platform_user_enabled" {
28-
description = "The user is enabled"
31+
description = "Flag to enable user for the platform. Either this or `platform_iam_role_enabled` should be enabled"
2932
value = var.platform_feature_enabled && var.platform_user_enabled
3033
}
3134

@@ -48,20 +51,54 @@ output "platform_user_arn" {
4851
################################################################################
4952
# Bucket details
5053
################################################################################
51-
output "platform_user_bucket_name" {
52-
description = "The bucket's ID/name"
54+
output "platform_bucket_enabled" {
55+
description = "Flag to enable S3 bucket for the platform"
56+
value = var.platform_feature_enabled && var.feature_blob_storage_enabled
57+
}
58+
59+
output "platform_bucket_name" {
60+
description = "Name/ID of the S3 bucket"
5361
value = var.feature_blob_storage_enabled ? module.truefoundry_bucket[0].s3_bucket_id : ""
5462
}
5563

56-
output "platform_user_bucket_arn" {
57-
description = "The bucket's arn"
64+
output "platform_bucket_arn" {
65+
description = "ARN of the S3 bucket"
5866
value = var.feature_blob_storage_enabled ? module.truefoundry_bucket[0].s3_bucket_arn : ""
5967
}
6068

6169
################################################################################
6270
# ECR details
6371
################################################################################
64-
output "platform_user_ecr_url" {
72+
output "platform_ecr_enabled" {
73+
description = "Flag to enable ECR for the platform"
74+
value = var.platform_feature_enabled && var.feature_docker_registry_enabled
75+
}
76+
77+
output "platform_ecr_url" {
6578
description = "The ECR url to connect"
6679
value = var.feature_docker_registry_enabled ? "${var.aws_account_id}.dkr.ecr.${var.aws_region}.amazonaws.com" : ""
6780
}
81+
82+
################################################################################
83+
# Secrets Manager details
84+
################################################################################
85+
output "platform_secrets_manager_enabled" {
86+
description = "Flag to enable Secrets Manager for the platform"
87+
value = var.platform_feature_enabled && var.feature_secrets_manager_enabled
88+
}
89+
90+
################################################################################
91+
# Parameter Store details
92+
################################################################################
93+
output "platform_ssm_enabled" {
94+
description = "Flag to enable Parameter Store for the platform"
95+
value = var.platform_feature_enabled && var.feature_parameter_store_enabled
96+
}
97+
98+
################################################################################
99+
# Cluster integration details
100+
################################################################################
101+
output "platform_cluster_integration_enabled" {
102+
description = "Flag to enable cluster integration for the platform"
103+
value = var.platform_feature_enabled && var.feature_cluster_integration_enabled
104+
}

upgrade-guide.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# AWS Platform Features Upgrade Guide
22
This guide helps in migration from the old terraform modules to the new one.
33

4-
# Updgrade guide to AWS platform features module from 0.2.2 to 0.3.0
4+
# Upgrade guide to AWS platform features module from 0.3.0 to 0.4.0
5+
1. When upgrading terraform version for platform features ensure that you are running on the latest version `0.3.x` and the platform features is upgraded to the newer 0.4.x version.
6+
2. When the `platform_role_enable_override` is set to `false`, then a iam role wil be created with a unique prefix
7+
3. The following output variables have been replaced with the new ones;
8+
- `platform_user_bucket_name` to `platform_bucket_name`
9+
- `platform_user_bucket_arn` to `platform_bucket_arn`
10+
- `platform_user_ecr_url` to `platform_ecr_url`
11+
4. The following outputs have been removed;
12+
- `platform_iam_role_name`
13+
14+
# Upgrade guide to AWS platform features module from 0.2.2 to 0.3.0
515
1. When upgrading terraform version for platform features ensure that you are running on version `0.2.x` and the platform features is upgraded to the newer 0.3.x version.
616
2. Update the following variables;
717
- `feature_secrets_enabled` to `feature_parameter_store_enabled`

variables.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ variable "control_plane_roles" {
4040
}
4141

4242
variable "platform_role_enable_override" {
43-
description = "Enable overriding the platform role name. You need to pass s3_override_name to pass the bucket name"
43+
description = "Enable overriding the platform role name. You need to pass blob_storage_override_name to pass the bucket name"
4444
type = bool
4545
default = false
4646
}
@@ -89,7 +89,7 @@ variable "feature_blob_storage_enabled" {
8989
}
9090

9191
variable "blob_storage_enable_override" {
92-
description = "Enable overriding the name of s3 bucket. This will only be used if feature_blob_storage_enabled is enabled. You need to pass s3_override_name to pass the bucket name"
92+
description = "Enable overriding the name of s3 bucket. This will only be used if feature_blob_storage_enabled is enabled. You need to pass blob_storage_override_name to pass the bucket name"
9393
type = bool
9494
default = false
9595
}

0 commit comments

Comments
 (0)