Skip to content

Commit a97a2d3

Browse files
Add Terraform import blocks for existing resources
Import ECR repos and Lambda functions into new resource names. Remove old cloud_lambda resources from state. Can be removed after first successful apply. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c51f86a commit a97a2d3

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

terraform/imports.tf

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# One-time imports and moves for existing resources now managed by Terraform.
2+
# These blocks can be removed after the first successful apply.
3+
4+
# Remove old resource names from state (renamed, not deleted)
5+
removed {
6+
from = aws_ecr_repository.cloud_lambda["to-www"]
7+
lifecycle { destroy = false }
8+
}
9+
removed {
10+
from = aws_ecr_repository.cloud_lambda["from-github"]
11+
lifecycle { destroy = false }
12+
}
13+
removed {
14+
from = aws_lambda_function.cloud_lambda["to-www"]
15+
lifecycle { destroy = false }
16+
}
17+
removed {
18+
from = aws_lambda_function.cloud_lambda["from-github"]
19+
lifecycle { destroy = false }
20+
}
21+
removed {
22+
from = aws_lambda_function.cloud_lambda["to-www"]
23+
lifecycle { destroy = false }
24+
}
25+
26+
# ECR repositories
27+
import {
28+
to = aws_ecr_repository.lambda["to-www"]
29+
id = "to-www"
30+
}
31+
import {
32+
to = aws_ecr_repository.lambda["from-github"]
33+
id = "from-github"
34+
}
35+
import {
36+
to = aws_ecr_repository.lambda["from-youtube"]
37+
id = "from-youtube"
38+
}
39+
import {
40+
to = aws_ecr_repository.lambda["from-discogs"]
41+
id = "from-discogs"
42+
}
43+
import {
44+
to = aws_ecr_repository.lambda["to-spotify"]
45+
id = "to-spotify"
46+
}
47+
import {
48+
to = aws_ecr_repository.lambda["manage-playlists"]
49+
id = "manage-playlists"
50+
}
51+
52+
# Cloud Lambda functions (renamed from cloud_lambda to cloud)
53+
import {
54+
to = aws_lambda_function.cloud["to-www"]
55+
id = "mirror-fm_to-www"
56+
}
57+
import {
58+
to = aws_lambda_function.cloud["from-github"]
59+
id = "mirror-fm_from-github"
60+
}
61+
62+
# Fallback Lambda functions
63+
import {
64+
to = aws_lambda_function.fallback["from-youtube"]
65+
id = "mirror-fm_from-youtube"
66+
}
67+
import {
68+
to = aws_lambda_function.fallback["from-discogs"]
69+
id = "mirror-fm_from-discogs"
70+
}
71+
import {
72+
to = aws_lambda_function.fallback["to-spotify"]
73+
id = "mirror-fm_to-spotify"
74+
}
75+
import {
76+
to = aws_lambda_function.fallback["manage-playlists"]
77+
id = "mirror-fm_manage-playlists"
78+
}

0 commit comments

Comments
 (0)