Skip to content

Commit

Permalink
again
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Feb 13, 2026
1 parent fecceb6 commit 100f977
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
21 changes: 11 additions & 10 deletions common/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,31 @@ data "aws_subnet" "subnets" {
id = each.key
}

# Get portfolio details if we provided the ID
// Get portfolio details if we resolved an ID
data "aws_servicecatalog_portfolio" "by_id" {
count = var.portfolio_id != null ? 1 : 0
id = var.portfolio_id
count = local.portfolio_id != null ? 1 : 0
id = local.portfolio_id
accept_language = var.accept_language
}

# Get product details by ID (requires product_id)
// Get product details by ID (requires product_id)
data "aws_servicecatalog_product" "by_id" {
count = var.product_id != null ? 1 : 0
id = var.product_id
count = local.product_id != null ? 1 : 0
id = local.product_id
accept_language = var.accept_language
}

# Get the latest provisioning artifact (product version)
// Get the latest provisioning artifact (product version)
data "aws_servicecatalog_provisioning_artifacts" "this" {
count = local.product_id != null ? 1 : 0
accept_language = var.accept_language
product_id = var.product_id
product_id = local.product_id
}

data "external" "portfolio" {
program = ["bash", "-c", "aws servicecatalog list-portfolios --region ${local.region} --query PortfolioDetails[?contains(DisplayName, 'Service Portfolio for')] | [0] | {id: Id}"]
program = ["bash", "-c", "aws servicecatalog list-portfolios --region ${local.region} --query \"PortfolioDetails[?contains(DisplayName, 'Service Portfolio for csvd-dev account')]|[0]|{id: Id}\" --output json"]
}

data "external" "product" {
program = ["bash", "-c", "aws servicecatalog search-products --region ${local.region} --query ProductViewSummaries[?contains(Name, 'RHEL')] | [0] | {id: ProductId}"]
program = ["bash", "-c", "aws servicecatalog search-products --region ${local.region} --filters 'SearchQuery=EC2 Instance' --query \"ProductViewSummaries[?contains(Name, 'RHEL')]|[0]|{id: ProductId}\" --output json"]
}
4 changes: 2 additions & 2 deletions common/defaults.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ locals {
product_id = var.product_id != null ? var.product_id : try(data.external.product.result.id, null)

# Get the latest provisioning artifact ID
latest_artifact_id = try(
[for artifact in data.aws_servicecatalog_provisioning_artifacts.this.provisioning_artifact_details :
latest_artifact_id = local.product_id == null ? null : try(
[for artifact in data.aws_servicecatalog_provisioning_artifacts.this[0].provisioning_artifact_details :
artifact.id if artifact.active
][0],
null
Expand Down

0 comments on commit 100f977

Please sign in to comment.