KurdTt-
KurdTt-

Reputation: 533

ImportValue with Sub in CertificateArn

I've got template.yaml specification as below:

Resources:
  DomainName:
    Type: AWS::ApiGateway::DomainName
      Properties:
        CertificateArn:
          Fn::ImportValue: !Sub: "${Stage}:config:GlobalCertificateArnB"
        DomainName: !Ref ServiceDomainName
        SecurityPolicy: "TLS_1_2"

And It does not validate due to Reason: Template Error: Encountered unsupported function: Fn::Sub. So I changed it to:

Resources:
  DomainName:
    Type: AWS::ApiGateway::DomainName
    Properties:
      CertificateArn:
        Fn::ImportValue:
          Fn::Sub: "${Stage}:config:GlobalCertificateArnB"
      DomainName: !Ref ServiceDomainName
      SecurityPolicy: "TLS_1_2"

Now I've got Reason: Template error: the attribute in Fn::ImportValue must not depend on any resources, imported values, or Fn::GetAZs.

Regarding to this I should use it without any problem, but even in this form from example:

Fn::ImportValue:
  !Sub "${NetworkStackName}-SecurityGroupID"

does not work.

How can I fix this?

Upvotes: 0

Views: 14

Answers (0)

Related Questions