ls plugins\/cdktf \naccess_key.go access_key_test.go cdktf.go plugin.go<\/code><\/pre>\n\u751f\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306b\u306fTODO\u30b3\u30e1\u30f3\u30c8\u304c\u8ffd\u8a18\u3055\u308c\u3066\u304a\u308a\u3001\u72ec\u81ea\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u30b3\u30de\u30f3\u30c9\uff08\u4eca\u56de\u306fcdktf\uff09\u306b\u5fdc\u3058\u3066\u4fee\u6b63\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
\u30d7\u30e9\u30b0\u30a4\u30f3\u5b9a\u7fa9\u306e\u66f4\u65b0<\/h3>\n
plugin.go\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u8a8d\u8a3c\u60c5\u5831\u306e\u7a2e\u985e\u3084\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306a\u3069\u306e\u57fa\u672c\u60c5\u5831\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002
\n\u4ee5\u4e0b\u306b\u3001plugin.go\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n
package cdktf\n\nimport (\n "github.com\/1Password\/shell-plugins\/sdk"\n "github.com\/1Password\/shell-plugins\/sdk\/schema"\n)\n\nfunc New() schema.Plugin {\n return schema.Plugin{\n Name: "cdktf",\n Platform: schema.PlatformInfo{\n Name: "AWS",\n Homepage: sdk.URL("https:\/\/developer.hashicorp.com\/terraform\/tutorials\/cdktf\/cdktf-install"), \/\/ URL\u3092cdktf\u516c\u5f0f\u30b5\u30a4\u30c8\u306b\u5909\u66f4\n },\n Credentials: []schema.CredentialType{\n AccessKey(),\n },\n Executables: []schema.Executable{\n AWSCLI(),\n },\n }\n}\n<\/code><\/pre>\n\u8cc7\u683c\u60c5\u5831\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0<\/h3>\n
access_key.go\u306b\u306f\u8cc7\u683c\u60c5\u5831\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u308a\u3001\u8cc7\u683c\u60c5\u5831\u306e\u30b9\u30ad\u30fc\u30de\u30841Password\u3078\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\u65b9\u6cd5\u306a\u3069\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002
\n\u751f\u6210\u3055\u308c\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u5909\u66f4\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n
func AccessKey() schema.CredentialType {\n return schema.CredentialType{\n Name: credname.AccessKey, \/\/TODO\n DocsURL: sdk.URL("https:\/\/docs.aws.amazon.com\/IAM\/latest\/UserGuide\/id_credentials_access-keys.html"), \/\/\u8a8d\u8a3c\u60c5\u5831\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306eURL\n ManagementURL: sdk.URL("https:\/\/console.aws.amazon.com\/iam"), \/\/\u8a8d\u8a3c\u60c5\u5831\u306e\u7ba1\u7406\u753b\u9762\u306eURL\n Fields: []schema.CredentialField{\n {\n Name: fieldname.AccessKeyID,\n MarkdownDescription: "The ID of the access key used to authenticate to AWS.",\n Composition: &schema.ValueComposition{ \/\/AccessKey\u306e\u30b9\u30ad\u30fc\u30de\u3092\u5b9a\u7fa9\n Length: 20,\n Prefix: "",\n Charset: schema.Charset{\n Uppercase: true,\n Digits: true,\n },\n },\n },\n \/\/\u751f\u6210\u3055\u308c\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u306fAccessKey\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f\u304c\u751f\u6210\u3055\u308c\u308b\u305f\u3081\u3001SecretAccessKey\u7528\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\n {\n Name: fieldname.SecretAccessKey,\n MarkdownDescription: "The secret access key used to authenticate to AWS.",\n Secret: true,\n Composition: &schema.ValueComposition{ \/\/SecretAccessKey\u306e\u30b9\u30ad\u30fc\u30de\u3092\u5b9a\u7fa9\n Length: 40,\n Charset: schema.Charset{\n Uppercase: true,\n Lowercase: true,\n Digits: true,\n },\n },\n },\n \/\/\u30ea\u30fc\u30b8\u30e7\u30f3\u7528\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\n {\n Name: fieldname.DefaultRegion,\n MarkdownDescription: "The default region to use for this access key.",\n Optional: true,\n },\n \/\/\u30ef\u30f3\u30bf\u30a4\u30e0\u30d1\u30b9\u30ef\u30fc\u30c9\u7528\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\n {\n Name: fieldname.OneTimePassword,\n MarkdownDescription: "The one-time code value for MFA authentication.",\n Optional: true,\n },\n \/\/TODO\n {\n Name: fieldname.MFASerial,\n MarkdownDescription: "ARN of the MFA serial number to use to generate temporary STS credentials if the item contains a TOTP setup.",\n Optional: true,\n },\n },\n \/\/\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3078\u8cc7\u683c\u60c5\u5831\u3092\u5272\u308a\u5f53\u3066\u308b\u65b9\u6cd5\u3092\u8a18\u8ff0\u3002AWS\u7528\u306eProvisioner\u306fSDK\u3068\u3057\u3066\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u305d\u3061\u3089\u3092\u5229\u7528\u3059\u308b\u3002\n DefaultProvisioner: AWSProvisioner(),\n Importer: importer.TryAll(\n importer.TryEnvVarPair(defaultEnvVarMapping),\n importer.TryEnvVarPair(map[string]sdk.FieldName{\n "AMAZON_ACCESS_KEY_ID": fieldname.AccessKeyID,\n "AMAZON_SECRET_ACCESS_KEY": fieldname.SecretAccessKey,\n "AWS_DEFAULT_REGION": fieldname.DefaultRegion,\n }),\n importer.TryEnvVarPair(map[string]sdk.FieldName{\n "AWS_ACCESS_KEY": fieldname.AccessKeyID,\n "AWS_SECRET_KEY": fieldname.SecretAccessKey,\n "AWS_DEFAULT_REGION": fieldname.DefaultRegion,\n }),\n importer.TryEnvVarPair(map[string]sdk.FieldName{\n "AWS_ACCESS_KEY": fieldname.AccessKeyID,\n "AWS_ACCESS_SECRET": fieldname.SecretAccessKey,\n "AWS_DEFAULT_REGION": fieldname.DefaultRegion,\n }),\n TryCredentialsFile(),\n )}\n}\n\/\/SDK\u306b\u5fc5\u8981\u306a\u5909\u6570\u306e\u5b9a\u7fa9\nvar defaultEnvVarMapping = map[string]sdk.FieldName{\n "AWS_ACCESS_KEY_ID": fieldname.AccessKeyID,\n "AWS_SECRET_ACCESS_KEY": fieldname.SecretAccessKey,\n "AWS_DEFAULT_REGION": fieldname.DefaultRegion,\n}\n\n\/\/ SDK\u306b\u5fc5\u8981\u306a\u95a2\u6570\u306e\u5b9a\u7fa9\nfunc TryCredentialsFile() sdk.Importer {\n return importer.TryFile("~\/.aws\/credentials", func(ctx context.Context, contents importer.FileContents, in sdk.ImportInput, out *sdk.ImportAttempt) {\n credentialsFile, err := contents.ToINI()\n if err != nil {\n out.AddError(err)\n return\n }\n\n configPath := os.Getenv("AWS_CONFIG_FILE")\n if configPath != "" {\n if strings.HasPrefix(configPath, "~") {\n configPath = in.FromHomeDir(configPath[1:])\n } else {\n configPath = in.FromRootDir(configPath)\n }\n } else {\n configPath = in.FromHomeDir(".aws", "config") \/\/ default config file location\n }\n var configFile *ini.File\n configContent, err := os.ReadFile(configPath)\n if err != nil && !os.IsNotExist(err) {\n out.AddError(err)\n }\n configFile, err = importer.FileContents(configContent).ToINI()\n if err != nil {\n out.AddError(err)\n }\n\n for _, section := range credentialsFile.Sections() {\n profileName := section.Name()\n fields := make(map[sdk.FieldName]string)\n if section.HasKey("aws_access_key_id") && section.Key("aws_access_key_id").Value() != "" {\n fields[fieldname.AccessKeyID] = section.Key("aws_access_key_id").Value()\n }\n\n if section.HasKey("aws_secret_access_key") && section.Key("aws_secret_access_key").Value() != "" {\n fields[fieldname.SecretAccessKey] = section.Key("aws_secret_access_key").Value()\n }\n\n if configFile != nil {\n configSection := getConfigSectionByProfile(configFile, profileName)\n if configSection != nil {\n if configSection.HasKey("region") && configSection.Key("region").Value() != "" {\n fields[fieldname.DefaultRegion] = configSection.Key("region").Value()\n }\n }\n }\n\n if fields[fieldname.AccessKeyID] != "" && fields[fieldname.SecretAccessKey] != "" {\n out.AddCandidate(sdk.ImportCandidate{\n Fields: fields,\n NameHint: importer.SanitizeNameHint(profileName),\n })\n }\n }\n })\n}<\/code><\/pre>\n\u4e0a\u8a18\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306b\u52a0\u3048\u3066\u3001SDK\u306b\u5fc5\u8981\u306a\u4ee5\u4e0b\u30d5\u30a1\u30a4\u30eb\u3092plugins\/aws<\/code>\u304b\u3089plugins\/cdktf<\/code>\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n\n- provisioner.go<\/li>\n
- sts_provisioner.go<\/li>\n
- utils.go<\/li>\n<\/ul>\n
\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\u306e\u5b9a\u7fa9<\/h3>\n
\u6700\u5f8c\u306b\u3001cdktf.go\u3092\u66f4\u65b0\u3057\u307e\u3059\u3002
\ncdktf.go\u3067\u306f1Password\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u8a8d\u8a3c\u60c5\u5831\u3092\u5229\u7528\u3057\u3066\u8a8d\u8a3c\u3092\u51e6\u7406\u3059\u308bCLI\u3084\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002
\n\u751f\u6210\u3055\u308c\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u5909\u66f4\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n
package cdktf\n\nimport (\n "github.com\/1Password\/shell-plugins\/sdk"\n "github.com\/1Password\/shell-plugins\/sdk\/needsauth"\n "github.com\/1Password\/shell-plugins\/sdk\/schema"\n "github.com\/1Password\/shell-plugins\/sdk\/schema\/credname"\n)\n\nfunc CDKTFCLI() schema.Executable {\n return schema.Executable{\n Name: "CDK for Terraform CLI",\n Runs: []string{"cdktf"},\n DocsURL: sdk.URL("https:\/\/developer.hashicorp.com\/terraform\/cdktf"),\n NeedsAuth: needsauth.IfAll(\n needsauth.NotForHelpOrVersion(),\n needsauth.NotWithoutArgs(),\n ),\n Uses: []schema.CredentialUsage{\n {\n Name: credname.AccessKey,\n },\n },\n }\n}<\/code><\/pre>\n\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u691c\u8a3c\u30fb\u30d3\u30eb\u30c9<\/h3>\n
\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u8cc7\u683c\u60c5\u5831\u3084\u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u304c\u6b63\u3057\u304f\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002
\n\u9805\u76ee\u3054\u3068\u306b\u78ba\u8a8d\u304c\u884c\u308f\u308c\u3001\u6b63\u3057\u304f\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u7b87\u6240\u306b\u306f\u30c1\u30a7\u30c3\u30af\u30de\u30fc\u30af\u304c\u3064\u304d\u307e\u3059\u3002<\/p>\n
make cdktf\/validate<\/code><\/pre>\n\u691c\u8a3c\u306b\u6210\u529f\u3057\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u304b\u3089\u30d3\u30eb\u30c9\u3092\u5b9f\u65bd\u3057\u307e\u3059\u3002<\/p>\n
make cdktf\/build<\/code><\/pre>\n\u30d3\u30eb\u30c9\u306e\u5b8c\u4e86\u5f8c\u3001\u4f5c\u6210\u3057\u305f\u30d7\u30e9\u30b0\u30a4\u30f3\u304c1password CLI\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u4e00\u89a7\u306b\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n
op plugin list<\/code><\/pre>\n\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u691c\u8a3c<\/h3>\n
\u3053\u3053\u3067\u306f\u5b9f\u969b\u306b\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u30011password\u7d4c\u7531\u3067\u30b3\u30de\u30f3\u30c9\u304c\u8a8d\u8a3c\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n
\u307e\u305a\u306f\u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u3001cdktf\u3067\u7c21\u5358\u306a\u30ea\u30bd\u30fc\u30b9\u3092\u4f5c\u6210\u3059\u308b\u30b9\u30bf\u30c3\u30af\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n
mkdir test_op_plugin\ncd test_op_plugin\ncdktf init --template="typescript" --providers="aws@~>4.0"<\/code><\/pre>\n\u6b21\u306b\u3001\u4f5c\u6210\u3059\u308b\u30ea\u30bd\u30fc\u30b9\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002
\n\u672c\u8a18\u4e8b\u306e\u76ee\u7684\u3067\u306f\u306a\u3044\u306e\u3067CDKTF\u3067\u30ea\u30bd\u30fc\u30b9\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5\u306e\u8aac\u660e\u306f\u5272\u611b\u3057\u307e\u3059\u3002<\/p>\n
\u6700\u5f8c\u306b\u30011password\u7d4c\u7531\u3067cdktf\u30b3\u30de\u30f3\u30c9\u304c\u8a8d\u8a3c\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n
cdktf cdploy<\/code><\/pre>\n\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001Terminal\u306bWARNING\u304c\u8868\u793a\u3055\u308c\u3001Touch ID\u3067\u6307\u7d0b\u8a8d\u8a3c\u304c\u6c42\u3081\u3089\u308c\u308c\u3070\u6210\u529f\u3067\u3059\u3002
\n\u30c0\u30a4\u30a2\u30ed\u30b0\u306e\u6307\u793a\u901a\u308a\u306bTouch ID\u3092\u4f7f\u7528\u3059\u308c\u3070\u8a8d\u8a3c\u3055\u308c\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u6700\u5f8c\u306b<\/h2>\n
1Password Shell\u306e\u72ec\u81ea\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f5c\u6210\u3057\u3001cdktf\u3092\u6307\u7d0b\u8a8d\u8a3c\u3067\u5b9f\u884c\u3067\u304d\u308b\u69d8\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002
\n\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u306a\u3069\u306e\u8a8d\u8a3c\u60c5\u5831\u306f\u6975\u529b\u5229\u7528\u3057\u306a\u3044\u65b9\u304c\u826f\u3044\u3068\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3069\u3046\u3057\u3066\u3082\u5fc5\u8981\u306a\u5834\u5408\u3082\u51fa\u3066\u304f\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002
\n\u305d\u3093\u306a\u6642\u3082\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u30011Password\u306a\u3069\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u7ba1\u7406\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u30ea\u30b9\u30af\u3092\u4e0b\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n
\u4ee5\u4e0a\u3001Champ\ud83d\udc51\u3067\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u521d\u3081\u307e\u3057\u3066\u30012023\u5e741\u6708\u306bDWS\u3078\u5165\u793e\u3057\u305fChamp\ud83d\udc51\u3067\u3059 \ud83d\ude4c \u7686\u3055\u3093\u306fCLI\u3067\u8a8d\u8a3c\u60c5\u5831\u3092\u5229\u7528\u3059\u308b\u969b\u306f\u3069\u306e\u3088\u3046\u306a\u65b9\u6cd5\u3067\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u304b\uff1f \u4ee5\u524d\u306f\u8a8d\u8a3c\u60c5\u5831\u3092\u30d7\u30ec\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u5f62\u5f0f\u3067\u30ed\u30fc\u30ab\u30eb\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u73fe\u5728 […]<\/p>\n","protected":false},"author":2,"featured_media":4687,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jinr_url_youtube":"","_jinr_pip_youtube":false,"_jinr_time_youtube":"","_jinr_thumb_youtube":"","_jinr_media_youtube":"","_jinr_category_edit":false,"_jinr_category":"","_jinr_title_display":false,"_jinr_snsbutton_display":false,"_jinr_ads_display":false,"_jinr_thumbnail_display":false,"_jinr_profile_display":false,"_jinr_relatedpost_display":false,"_jinr_sidebar1col_display":false,"_jinr_sidebar2col_display":false,"_jinr_seotitle_display":"","_jinr_description_display":"","_jinr_keyword_display":"","_jinr_hastag_display":"","_jinr_canonical_display":"","_jinr_noindex_display":false,"_jinr_paidpost":false,"_jinr_paidpost_product_id":"","_jinr_headtag_article":""},"categories":[3,4],"tags":[16,60,93],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/4685"}],"collection":[{"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=4685"}],"version-history":[{"count":0,"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/4685\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=4685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=4685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cms-mordpress.test.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=4685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}