Closed4

App Runner の設定を terraform import する Scrap

sogaohsogaoh

aws_apprunner_service

terraform import \
   aws_apprunner_service.XXXXXX_apprunner_service \
   arn:aws:apprunner:ap-northeast-1:XXXXXXXXXXXX:service/production-XXX-XXXXX-XXXX/7f929eb255fa484799abc708767b37fc

これだけ成功。

aws_apprunner_auto_scaling_configuration_version

↑にあった autoscalingconfiguration の arn を使ってみたが Error

terraform import \
  aws_apprunner_auto_scaling_configuration_version.YYYYYYY \
  arn:aws:apprunner:ap-northeast-1:XXXXXXXXXXXX:autoscalingconfiguration/DefaultConfiguration/1/00000000000000000000000000000001

・・・
 Error: error listing tags for App Runner AutoScaling Configuration Version 
(arn:aws:apprunner:ap-northeast-1:XXXXXXXXXXXX:autoscalingconfiguration/DefaultConfiguration/1/00000000000000000000000000000001): 
InvalidRequestException: Error in listing tags for resource: 
The fusion resource is not taggable based on the provided arn: arn:aws:apprunner:ap-northeast-1:XXXXXXXXXXXX:autoscalingconfiguration/DefaultConfiguration/1/00000000000000000000000000000001

aws_apprunner_custom_domain_association

指定すべき arn がわからずに結局 Error

terraform import aws_apprunner_custom_domain_association.navi_api_apprunner_domain ZZZZ-ZZZ.ZZZZZZZZ.ZZZ

・・・
Error: unexpected format of ID (ZZZZ-ZZZ.ZZZZZZZZ.ZZZ), expected domain_name,service_arn
sogaohsogaoh

AWS CLI v2 でもできるようになっていたので実行したら採取できた

❯ aws --version
aws-cli/2.2.7 Python/3.9.5 Darwin/19.6.0 source/x86_64 prompt/off

❯ aws apprunner describe-auto-scaling-configuration --auto-scaling-configuration-arn arn:aws:apprunner:ap-northeast-1:XXXXXXXXXXXX:autoscalingconfiguration/DefaultConfiguration/1/00000000000000000000000000000001
{
    "AutoScalingConfiguration": {
        "AutoScalingConfigurationArn": "arn:aws:apprunner:ap-northeast-1:XXXXXXXXXXXX:autoscalingconfiguration/DefaultConfiguration/1/00000000000000000000000000
        "AutoScalingConfigurationName": "DefaultConfiguration",
        "AutoScalingConfigurationRevision": 1,
        "Latest": true,
        "Status": "active",
        "MaxConcurrency": 100,
        "MinSize": 1,
        "MaxSize": 25
    }
}

❯ aws apprunner describe-custom-domains --service-arn arn:aws:apprunner:ap-northeast-1:123456789012:service/production-XXX-YYY-ZZZ/12345678901234567890123456789012
{
    "DNSTarget": "1234567890.ap-northeast-1.awsapprunner.com",
    "ServiceArn": "arn:aws:apprunner:ap-northeast-1:123456789012:service/production-XXX-YYY-ZZZ/12345678901234567890123456789012",
    "CustomDomains": [
        {
            "DomainName": "YYY-ZZZ.example.com",
            "EnableWWWSubdomain": false,
            "CertificateValidationRecords": [
                {
                    "Name": "NNNNNNNNNNNN",
                    "Type": "CNAME",
                    "Value": "VVVVVVVVVVVVVVVV",
                    "Status": "SUCCESS"
                },
                {
                    "Name": "NNNNNNNNNNNN",
                    "Type": "CNAME",
                    "Value": "VVVVVVVVVVVVVVVV",
                    "Status": "SUCCESS"
                }
            ],
            "Status": "active"
        }
    ]
}
このスクラップは2021/07/23にクローズされました