I have A template that creates IAM roles In cloud Formation YAML. I need service Anr in next template, But I am getting this error.

Template contains errors.: Invalid template resource property 'Fn::ImportValue'
===============================================================================

IAMStack

`Resources:
 CodeDeployTrustRole:
 Type: AWS::IAM::Role
 Properties:
 AssumeRolePolicyDocument:
 Statement:
 - Sid: '1'
 Effect: Allow
 Principal:
 Service:
 - codedeploy.us-east-1.amazonaws.com
 - codedeploy.us-west-2.amazonaws.com
 Action: sts:AssumeRole
 Path: "/"
 CodeDeployRolePolicies:
 Type: AWS::IAM::Policy
 Properties:
 PolicyName: CodeDeployPolicy
 PolicyDocument:
 Statement:
 - Effect: Allow
 Resource:
 - "*"
 Action:
 - ec2:Describe*
 - Effect: Allow
 Resource:
 - "*"
 Action:
 - autoscaling:CompleteLifecycleAction
 - autoscaling:DeleteLifecycleHook
 - autoscaling:DescribeLifecycleHooks
 - autoscaling:DescribeAutoScalingGroups
 - autoscaling:PutLifecycleHook
 - autoscaling:RecordLifecycleActionHeartbeat
 Roles:
 - Ref: CodeDeployTrustRole
 InstanceRole:
 Type: AWS::IAM::Role
 Properties:
 AssumeRolePolicyDocument:
 Statement:
 - Effect: Allow
 Principal:
 Service:
 - ec2.amazonaws.com
 Action:
 - sts:AssumeRole
 Path: "/"
 InstanceRolePolicies:
 Type: AWS::IAM::Policy
 Properties:
 PolicyName: InstanceRole
 PolicyDocument:
 Statement:
 - Effect: Allow
 Action:
 - autoscaling:Describe*
 - autoscaling:EnterStandby
 - autoscaling:ExitStandby
 - cloudformation:Describe*
 - cloudformation:GetTemplate
 - s3:Get*
 Resource: "*"
 Roles:
 - Ref: InstanceRole
 InstanceRoleInstanceProfile:
 Type: AWS::IAM::InstanceProfile
 Properties:
 Path: "/"
 Roles:
 - Ref: InstanceRole
Outputs:
 CodeDeployServiceRoleARN:
 Value:
 Fn::GetAtt:
 - CodeDeployTrustRole
 - Arn`

==================================================================================
CodeDeploystack

`---
AWSTemplateFormatVersion: '2010-09-09'
Description: This template will create an s3bucket
Resources:
 S3Bucket:
 Type: AWS::S3::Bucket
 Properties:
 AccessControl: PublicRead
 BucketName: CodeDeploy
 CodeDeployApplication:
 Type: 'AWS::CodeDeploy::Application'
 Properties:
 ComputePlatform: ec2
 DeploymentGroup: 
 Type: AWS::CodeDeploy::DeploymentGroup
 Properties: 
 ApplicationName: 
 !Ref CodeDeployApplication
 Deployment: 
 Description: First time
 IgnoreApplicationStopFailures: true
 Revision:
 RevisionType: S3
 S3Location: 
 Bucket: 
 Ref: S3Bucket
 ServiceRoleArn: 
 'Fn::ImportValue': !Sub '${IAMStack}-CodeDeployServiceRoleARN'
Outputs:
 S3BucketName:
 Value:
 Ref: S3Bucket
 Description: Name of S3 bucket`