diff --git a/common/defaults.tf b/common/defaults.tf index 505eab5..8faaad4 100644 --- a/common/defaults.tf +++ b/common/defaults.tf @@ -1,13 +1,8 @@ locals { - # Get portfolio ID from lookup or variable - portfolio_id = var.portfolio_id != null ? var.portfolio_id : try( - [for p in data.aws_servicecatalog_portfolios.all[0].details : - p.id if can(regex(var.portfolio_name_pattern, p.name)) - ][0], - null - ) + # Portfolio ID is required - must be provided via var.portfolio_id + portfolio_id = var.portfolio_id - # Get product ID from variable or portfolio lookup + # Product ID is required - must be provided via var.product_id product_id = var.product_id # Get the latest provisioning artifact ID @@ -36,4 +31,7 @@ locals { value = tostring(value) } ] + + # Module name for tagging + module_name = "aws-servicecatalog/ec2" } diff --git a/common/locals.tf b/common/locals.tf index 5c23343..b491acd 100644 --- a/common/locals.tf +++ b/common/locals.tf @@ -1,39 +1,2 @@ # Intentionally empty file for consistency with aws-s3 pattern -# Module-specific locals should be defined in each submodule - -locals { - # Portfolio ID must be specified - portfolio_id = var.portfolio_id - - # Product ID must be specified - product_id = var.product_id - - # Get the latest provisioning artifact ID - latest_artifact_id = try( - [for artifact in data.aws_servicecatalog_provisioning_artifacts.this.provisioning_artifact_details : - artifact.id if artifact.active - ][0], - null - ) - - # Use provided path_id or default to latest - provisioning_artifact_id = var.path_id != null ? var.path_id : local.latest_artifact_id - - # Merge default parameters with user-provided parameters - default_parameters = {} - - parameters = merge( - local.default_parameters, - var.parameters - ) - - # Convert parameters map to the format expected by aws_servicecatalog_provisioned_product - provisioning_parameters = [ - for key, value in local.parameters : { - key = key - value = tostring(value) - } - ] - - module_name = try(data.aws_servicecatalog_product.by_id[0].name, "Unknown") -} \ No newline at end of file +# Module-specific locals should be defined in each submodule \ No newline at end of file