#!/usr/bin/env bash

set -xeuo pipefail

# When changing this script, remember to modify the corresponding github action
vendor=${1}
env=${2}
region=${3}
cluster_name=${4}
account_id=${5}
oidc_issuer=${6}

ROOT=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)

aliyun ros CreateStack \
  --RegionId $region \
  --StackName auto-deploy-$cluster_name-iam \
  --TemplateURL oss://ros-tmp-bucket-dev/iam-alicloud-tmpl.json \
  --Parameters.1.ParameterKey Env \
  --Parameters.1.ParameterValue $env \
  --Parameters.2.ParameterKey Region \
  --Parameters.2.ParameterValue $region \
  --Parameters.3.ParameterKey ClusterName \
  --Parameters.3.ParameterValue $cluster_name \
  --Parameters.4.ParameterKey AccountId \
  --Parameters.4.ParameterValue $account_id \
  --Parameters.5.ParameterKey OIDCIssuer \
  --Parameters.5.ParameterValue $oidc_issuer
