Uploaded image for project: 'Insights Experiences'
  1. Insights Experiences
  2. HMS-1430

Following aws cli commands to setup auth for provisioning leads to error due to double quotes

    • Scrum Sprint 25
    • None

      on production beta, when following the cli commands to create a source for provisioning in aws, it tells me to do this

       

      POLICY_ARN=$(aws iam create-policy --policy-name RH-HCC-provisioning-policy --policy-document '{
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "RedHatProvisioning",
          "Effect": "Allow",
          "Action": [
            "iam:GetPolicyVersion",
            "iam:GetPolicy",
            "iam:ListAttachedRolePolicies",
            "iam:GetRolePolicy",
            "ec2:CreateKeyPair",
            "ec2:CreateLaunchTemplate",
            "ec2:CreateLaunchTemplateVersion",
            "ec2:CreateTags",
            "ec2:DeleteKeyPair",
            "ec2:DeleteTags",
            "ec2:DescribeAvailabilityZones",
            "ec2:DescribeImages",
            "ec2:DescribeInstanceTypes",
            "ec2:DescribeInstances",
            "ec2:DescribeKeyPairs",
            "ec2:DescribeLaunchTemplates",
            "ec2:DescribeLaunchTemplateVersions",
            "ec2:DescribeRegions",
            "ec2:DescribeSecurityGroups",
            "ec2:DescribeSnapshotAttribute",
            "ec2:DescribeTags",
      }' | jq '.Policy.Arn')ces"

      checking the output of this, it shows (ID changed):

      $ echo $POLICY_ARN
      "arn:aws:iam::12345:policy/RH-HCC-provisioning-policy"

      Later, i try to use this POLICY_ARN in this step:

       aws iam attach-role-policy --role-name RH-HCC-provisioning-role --policy-arn $POLICY_ARN
      

      but i get an error:

       

      An error occurred (InvalidInput) when calling the AttachRolePolicy operation: ARN "arn:aws:iam::640667479973:policy/RH-HCC-provisioning-policy" is not valid.
      

      This seems due to the double quotes in the $POLICY_ARN variable, if i change that variable to just:  arn:aws:iam::12345:policy/RH-HCC-provisioning-policy   it works fine

       

              aabramov@redhat.com Adi Abramovich (Inactive)
              hms-jsherrill Justin Sherrill
              None
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: