From e9b19c7cdbde33aa2334870d07289a459c28d4d5 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 14:46:34 -0400 Subject: [PATCH 1/9] Run 'go get github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go@e6d3bb9dab7db0d47bab5d0e272586b8610dc65c && go mod tidy'. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 52e148615a..f5af472c53 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/cloudcontrol v1.18.7 github.com/aws/aws-sdk-go-v2/service/cloudformation v1.50.3 github.com/google/go-cmp v0.6.0 - github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 + github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.1-0.20240521184254-e6d3bb9dab7d github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 github.com/hashicorp/cli v1.1.6 github.com/hashicorp/go-hclog v1.6.3 diff --git a/go.sum b/go.sum index a5b9049c8d..af578b4296 100644 --- a/go.sum +++ b/go.sum @@ -110,8 +110,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 h1:N2V/ooY+BPQwwN3qPRIztByR8mWN6IqgULqVzGoUlog= -github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= +github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.1-0.20240521184254-e6d3bb9dab7d h1:iK50nA4Mb02irwPla9i5H2HUdvy8gdeROHs1rVqH0d8= +github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.1-0.20240521184254-e6d3bb9dab7d/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 h1:jgOMbQlypMpUMaqYJotjT7ERSMvQP00Mppgjgh8lNt8= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53/go.mod h1:nvpXIeF0ANfZ7sMssXKSSR3pyXfksajxoC2tl4jjN08= github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= From c1a8a414ebfac4c24658d6180543fd22ac0e7b56 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 14:49:31 -0400 Subject: [PATCH 2/9] generators: No type equivalent to object. --- internal/provider/generators/shared/codegen/emitter.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/internal/provider/generators/shared/codegen/emitter.go b/internal/provider/generators/shared/codegen/emitter.go index da31cf1dbf..27ddc96884 100644 --- a/internal/provider/generators/shared/codegen/emitter.go +++ b/internal/provider/generators/shared/codegen/emitter.go @@ -481,9 +481,6 @@ func (e Emitter) emitAttribute(tfType string, attributeNameMap map[string]string // // If the property has no specified type but has properties then assume it's an object. // - if len(property.PatternProperties) > 0 { - return features, unsupportedTypeError(path, propertyType) - } fallthrough case cfschema.PropertyTypeObject: From a835892781c55244c4a3ca2fde4070eba9c8c78e Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 14:50:10 -0400 Subject: [PATCH 3/9] r/awscc_apigatewayv2_route_response: Generate. --- .../route_response_resource_gen.go | 201 ++++++++++++++++++ .../route_response_resource_gen_test.go | 25 +++ internal/provider/all_schemas.hcl | 6 - internal/provider/plural_data_sources.go | 1 + internal/provider/resources.go | 1 + internal/provider/singular_data_sources.go | 1 + 6 files changed, 229 insertions(+), 6 deletions(-) create mode 100644 internal/aws/apigatewayv2/route_response_resource_gen.go create mode 100644 internal/aws/apigatewayv2/route_response_resource_gen_test.go diff --git a/internal/aws/apigatewayv2/route_response_resource_gen.go b/internal/aws/apigatewayv2/route_response_resource_gen.go new file mode 100644 index 0000000000..260d3fedfb --- /dev/null +++ b/internal/aws/apigatewayv2/route_response_resource_gen.go @@ -0,0 +1,201 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package apigatewayv2 + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" +) + +func init() { + registry.AddResourceFactory("awscc_apigatewayv2_route_response", routeResponseResource) +} + +// routeResponseResource returns the Terraform awscc_apigatewayv2_route_response resource. +// This Terraform resource corresponds to the CloudFormation AWS::ApiGatewayV2::RouteResponse resource. +func routeResponseResource(ctx context.Context) (resource.Resource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ApiId + // CloudFormation resource type schema: + // + // { + // "description": "The API identifier.", + // "type": "string" + // } + "api_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The API identifier.", + Required: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.RequiresReplace(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ModelSelectionExpression + // CloudFormation resource type schema: + // + // { + // "description": "The model selection expression for the route response. Supported only for WebSocket APIs.", + // "type": "string" + // } + "model_selection_expression": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The model selection expression for the route response. Supported only for WebSocket APIs.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ResponseModels + // CloudFormation resource type schema: + // + // { + // "description": "The response models for the route response.", + // "type": "object" + // } + "response_models": schema.StringAttribute{ /*START ATTRIBUTE*/ + CustomType: jsontypes.NormalizedType{}, + Description: "The response models for the route response.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ResponseParameters + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "description": "The route response parameters.", + // "patternProperties": { + // "": { + // "additionalProperties": false, + // "description": "Specifies whether the parameter is required.", + // "properties": { + // "Required": { + // "description": "Specifies whether the parameter is required.", + // "type": "boolean" + // } + // }, + // "required": [ + // "Required" + // ], + // "type": "object" + // } + // } + // } + "response_parameters": // Pattern: "" + schema.MapNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Required + "required": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Description: "Specifies whether the parameter is required.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/ + boolplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Description: "The route response parameters.", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Map{ /*START PLAN MODIFIERS*/ + mapplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: RouteId + // CloudFormation resource type schema: + // + // { + // "description": "The route ID.", + // "type": "string" + // } + "route_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The route ID.", + Required: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.RequiresReplace(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: RouteResponseId + // CloudFormation resource type schema: + // + // { + // "description": "", + // "type": "string" + // } + "route_response_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "", + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: RouteResponseKey + // CloudFormation resource type schema: + // + // { + // "description": "The route response key.", + // "type": "string" + // } + "route_response_key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The route response key.", + Required: true, + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + // Corresponds to CloudFormation primaryIdentifier. + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + } + + schema := schema.Schema{ + Description: "The ``AWS::ApiGatewayV2::RouteResponse`` resource creates a route response for a WebSocket API. For more information, see [Set up Route Responses for a WebSocket API in API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-response.html) in the *API Gateway Developer Guide*.", + Version: 1, + Attributes: attributes, + } + + var opts generic.ResourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::ApiGatewayV2::RouteResponse").WithTerraformTypeName("awscc_apigatewayv2_route_response") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "api_id": "ApiId", + "model_selection_expression": "ModelSelectionExpression", + "required": "Required", + "response_models": "ResponseModels", + "response_parameters": "ResponseParameters", + "route_id": "RouteId", + "route_response_id": "RouteResponseId", + "route_response_key": "RouteResponseKey", + }) + + opts = opts.WithCreateTimeoutInMinutes(0).WithDeleteTimeoutInMinutes(0) + + opts = opts.WithUpdateTimeoutInMinutes(0) + + v, err := generic.NewResource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/apigatewayv2/route_response_resource_gen_test.go b/internal/aws/apigatewayv2/route_response_resource_gen_test.go new file mode 100644 index 0000000000..dbc17a9c8f --- /dev/null +++ b/internal/aws/apigatewayv2/route_response_resource_gen_test.go @@ -0,0 +1,25 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package apigatewayv2_test + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSApiGatewayV2RouteResponse_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::ApiGatewayV2::RouteResponse", "awscc_apigatewayv2_route_response", "test") + + td.ResourceTest(t, []resource.TestStep{ + { + Config: td.EmptyConfig(), + ExpectError: regexp.MustCompile("Missing required argument"), + }, + }) +} diff --git a/internal/provider/all_schemas.hcl b/internal/provider/all_schemas.hcl index 28509f1872..df0ae84c7c 100644 --- a/internal/provider/all_schemas.hcl +++ b/internal/provider/all_schemas.hcl @@ -217,12 +217,6 @@ resource_schema "aws_apigatewayv2_route" { resource_schema "aws_apigatewayv2_route_response" { cloudformation_type_name = "AWS::ApiGatewayV2::RouteResponse" - - # Suppression Reason: ResponseParameters is of unsupported type: "" - # https://github.com/hashicorp/terraform-provider-awscc/issues/1504 - suppress_resource_generation = true - suppress_singular_data_source_generation = true - suppress_plural_data_source_generation = true } resource_schema "aws_apigatewayv2_vpc_link" { diff --git a/internal/provider/plural_data_sources.go b/internal/provider/plural_data_sources.go index 1cc24ad271..f9e9331b82 100644 --- a/internal/provider/plural_data_sources.go +++ b/internal/provider/plural_data_sources.go @@ -19,6 +19,7 @@ //go:generate go run generators/plural-data-source/main.go -data-source awscc_apigatewayv2_api_mappings -cftype AWS::ApiGatewayV2::ApiMapping -package apigatewayv2 ../aws/apigatewayv2/api_mapping_plural_data_source_gen.go ../aws/apigatewayv2/api_mapping_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_apigatewayv2_domain_names -cftype AWS::ApiGatewayV2::DomainName -package apigatewayv2 ../aws/apigatewayv2/domain_name_plural_data_source_gen.go ../aws/apigatewayv2/domain_name_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_apigatewayv2_integration_responses -cftype AWS::ApiGatewayV2::IntegrationResponse -package apigatewayv2 ../aws/apigatewayv2/integration_response_plural_data_source_gen.go ../aws/apigatewayv2/integration_response_plural_data_source_gen_test.go +//go:generate go run generators/plural-data-source/main.go -data-source awscc_apigatewayv2_route_responses -cftype AWS::ApiGatewayV2::RouteResponse -package apigatewayv2 ../aws/apigatewayv2/route_response_plural_data_source_gen.go ../aws/apigatewayv2/route_response_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_apigatewayv2_vpc_links -cftype AWS::ApiGatewayV2::VpcLink -package apigatewayv2 ../aws/apigatewayv2/vpc_link_plural_data_source_gen.go ../aws/apigatewayv2/vpc_link_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_appconfig_applications -cftype AWS::AppConfig::Application -package appconfig ../aws/appconfig/application_plural_data_source_gen.go ../aws/appconfig/application_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_appconfig_extension_associations -cftype AWS::AppConfig::ExtensionAssociation -package appconfig ../aws/appconfig/extension_association_plural_data_source_gen.go ../aws/appconfig/extension_association_plural_data_source_gen_test.go diff --git a/internal/provider/resources.go b/internal/provider/resources.go index 2543dd5574..9bfc7cb932 100644 --- a/internal/provider/resources.go +++ b/internal/provider/resources.go @@ -40,6 +40,7 @@ //go:generate go run generators/resource/main.go -resource awscc_apigatewayv2_integration_response -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_IntegrationResponse.json -package apigatewayv2 -- ../aws/apigatewayv2/integration_response_resource_gen.go ../aws/apigatewayv2/integration_response_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_apigatewayv2_model -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_Model.json -package apigatewayv2 -- ../aws/apigatewayv2/model_resource_gen.go ../aws/apigatewayv2/model_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_apigatewayv2_route -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_Route.json -package apigatewayv2 -- ../aws/apigatewayv2/route_resource_gen.go ../aws/apigatewayv2/route_resource_gen_test.go +//go:generate go run generators/resource/main.go -resource awscc_apigatewayv2_route_response -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_RouteResponse.json -package apigatewayv2 -- ../aws/apigatewayv2/route_response_resource_gen.go ../aws/apigatewayv2/route_response_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_apigatewayv2_vpc_link -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_VpcLink.json -package apigatewayv2 -- ../aws/apigatewayv2/vpc_link_resource_gen.go ../aws/apigatewayv2/vpc_link_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_appconfig_application -cfschema ../service/cloudformation/schemas/AWS_AppConfig_Application.json -package appconfig -- ../aws/appconfig/application_resource_gen.go ../aws/appconfig/application_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_appconfig_configuration_profile -cfschema ../service/cloudformation/schemas/AWS_AppConfig_ConfigurationProfile.json -package appconfig -- ../aws/appconfig/configuration_profile_resource_gen.go ../aws/appconfig/configuration_profile_resource_gen_test.go diff --git a/internal/provider/singular_data_sources.go b/internal/provider/singular_data_sources.go index 0882fd6999..efc751920d 100644 --- a/internal/provider/singular_data_sources.go +++ b/internal/provider/singular_data_sources.go @@ -40,6 +40,7 @@ //go:generate go run generators/singular-data-source/main.go -data-source awscc_apigatewayv2_integration_response -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_IntegrationResponse.json -package apigatewayv2 ../aws/apigatewayv2/integration_response_singular_data_source_gen.go ../aws/apigatewayv2/integration_response_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_apigatewayv2_model -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_Model.json -package apigatewayv2 ../aws/apigatewayv2/model_singular_data_source_gen.go ../aws/apigatewayv2/model_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_apigatewayv2_route -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_Route.json -package apigatewayv2 ../aws/apigatewayv2/route_singular_data_source_gen.go ../aws/apigatewayv2/route_singular_data_source_gen_test.go +//go:generate go run generators/singular-data-source/main.go -data-source awscc_apigatewayv2_route_response -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_RouteResponse.json -package apigatewayv2 ../aws/apigatewayv2/route_response_singular_data_source_gen.go ../aws/apigatewayv2/route_response_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_apigatewayv2_vpc_link -cfschema ../service/cloudformation/schemas/AWS_ApiGatewayV2_VpcLink.json -package apigatewayv2 ../aws/apigatewayv2/vpc_link_singular_data_source_gen.go ../aws/apigatewayv2/vpc_link_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_appconfig_application -cfschema ../service/cloudformation/schemas/AWS_AppConfig_Application.json -package appconfig ../aws/appconfig/application_singular_data_source_gen.go ../aws/appconfig/application_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_appconfig_configuration_profile -cfschema ../service/cloudformation/schemas/AWS_AppConfig_ConfigurationProfile.json -package appconfig ../aws/appconfig/configuration_profile_singular_data_source_gen.go ../aws/appconfig/configuration_profile_singular_data_source_gen_test.go From dee47fc1cd261c1571b7c03997f4498f591273c7 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 14:56:46 -0400 Subject: [PATCH 4/9] Fix some resource exclusions. --- ...ntity_pool_role_attachment_resource_gen.go | 258 ++++++++++ ..._pool_role_attachment_resource_gen_test.go | 25 + .../cis_scan_configuration_resource_gen.go | 486 ++++++++++++++++++ ...is_scan_configuration_resource_gen_test.go | 46 ++ internal/provider/all_schemas.hcl | 11 - internal/provider/plural_data_sources.go | 1 + internal/provider/resources.go | 2 + internal/provider/singular_data_sources.go | 2 + 8 files changed, 820 insertions(+), 11 deletions(-) create mode 100644 internal/aws/cognito/identity_pool_role_attachment_resource_gen.go create mode 100644 internal/aws/cognito/identity_pool_role_attachment_resource_gen_test.go create mode 100644 internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go create mode 100644 internal/aws/inspectorv2/cis_scan_configuration_resource_gen_test.go diff --git a/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go b/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go new file mode 100644 index 0000000000..0abe140c05 --- /dev/null +++ b/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go @@ -0,0 +1,258 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package cognito + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" +) + +func init() { + registry.AddResourceFactory("awscc_cognito_identity_pool_role_attachment", identityPoolRoleAttachmentResource) +} + +// identityPoolRoleAttachmentResource returns the Terraform awscc_cognito_identity_pool_role_attachment resource. +// This Terraform resource corresponds to the CloudFormation AWS::Cognito::IdentityPoolRoleAttachment resource. +func identityPoolRoleAttachmentResource(ctx context.Context) (resource.Resource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Id + // CloudFormation resource type schema: + // + // { + // "type": "string" + // } + "identity_pool_role_attachment_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: IdentityPoolId + // CloudFormation resource type schema: + // + // { + // "type": "string" + // } + "identity_pool_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.RequiresReplace(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: RoleMappings + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "additionalProperties": false, + // "properties": { + // "AmbiguousRoleResolution": { + // "type": "string" + // }, + // "IdentityProvider": { + // "type": "string" + // }, + // "RulesConfiguration": { + // "additionalProperties": false, + // "properties": { + // "Rules": { + // "insertionOrder": false, + // "items": { + // "additionalProperties": false, + // "properties": { + // "Claim": { + // "type": "string" + // }, + // "MatchType": { + // "type": "string" + // }, + // "RoleARN": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Claim", + // "MatchType", + // "RoleARN", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array", + // "uniqueItems": false + // } + // }, + // "required": [ + // "Rules" + // ], + // "type": "object" + // }, + // "Type": { + // "type": "string" + // } + // }, + // "required": [ + // "Type" + // ], + // "type": "object" + // } + // } + // } + "role_mappings": // Pattern: "" + schema.MapNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: AmbiguousRoleResolution + "ambiguous_role_resolution": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: IdentityProvider + "identity_provider": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: RulesConfiguration + "rules_configuration": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Rules + "rules": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Claim + "claim": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: MatchType + "match_type": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: RoleARN + "role_arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Required: true, + PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/ + generic.Multiset(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Type + "type": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Map{ /*START PLAN MODIFIERS*/ + mapplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Roles + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "type": "string" + // } + // } + // } + "roles": // Pattern: "" + schema.MapAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Map{ /*START PLAN MODIFIERS*/ + mapplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + // Corresponds to CloudFormation primaryIdentifier. + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + } + + schema := schema.Schema{ + Description: "Resource Type definition for AWS::Cognito::IdentityPoolRoleAttachment", + Version: 1, + Attributes: attributes, + } + + var opts generic.ResourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::Cognito::IdentityPoolRoleAttachment").WithTerraformTypeName("awscc_cognito_identity_pool_role_attachment") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "ambiguous_role_resolution": "AmbiguousRoleResolution", + "claim": "Claim", + "identity_pool_id": "IdentityPoolId", + "identity_pool_role_attachment_id": "Id", + "identity_provider": "IdentityProvider", + "match_type": "MatchType", + "role_arn": "RoleARN", + "role_mappings": "RoleMappings", + "roles": "Roles", + "rules": "Rules", + "rules_configuration": "RulesConfiguration", + "type": "Type", + "value": "Value", + }) + + opts = opts.WithCreateTimeoutInMinutes(0).WithDeleteTimeoutInMinutes(0) + + opts = opts.WithUpdateTimeoutInMinutes(0) + + v, err := generic.NewResource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/cognito/identity_pool_role_attachment_resource_gen_test.go b/internal/aws/cognito/identity_pool_role_attachment_resource_gen_test.go new file mode 100644 index 0000000000..e1c4d98b5a --- /dev/null +++ b/internal/aws/cognito/identity_pool_role_attachment_resource_gen_test.go @@ -0,0 +1,25 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package cognito_test + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSCognitoIdentityPoolRoleAttachment_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Cognito::IdentityPoolRoleAttachment", "awscc_cognito_identity_pool_role_attachment", "test") + + td.ResourceTest(t, []resource.TestStep{ + { + Config: td.EmptyConfig(), + ExpectError: regexp.MustCompile("Missing required argument"), + }, + }) +} diff --git a/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go b/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go new file mode 100644 index 0000000000..7cc86635e1 --- /dev/null +++ b/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go @@ -0,0 +1,486 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package inspectorv2 + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" + "regexp" +) + +func init() { + registry.AddResourceFactory("awscc_inspectorv2_cis_scan_configuration", cisScanConfigurationResource) +} + +// cisScanConfigurationResource returns the Terraform awscc_inspectorv2_cis_scan_configuration resource. +// This Terraform resource corresponds to the CloudFormation AWS::InspectorV2::CisScanConfiguration resource. +func cisScanConfigurationResource(ctx context.Context) (resource.Resource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Arn + // CloudFormation resource type schema: + // + // { + // "description": "CIS Scan configuration unique identifier", + // "type": "string" + // } + "arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "CIS Scan configuration unique identifier", + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: ScanName + // CloudFormation resource type schema: + // + // { + // "description": "Name of the scan", + // "minLength": 1, + // "type": "string" + // } + "scan_name": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "Name of the scan", + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.LengthAtLeast(1), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Schedule + // CloudFormation resource type schema: + // + // { + // "description": "Choose a Schedule cadence", + // "properties": { + // "Daily": { + // "additionalProperties": false, + // "properties": { + // "StartTime": { + // "additionalProperties": false, + // "properties": { + // "TimeOfDay": { + // "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", + // "type": "string" + // }, + // "TimeZone": { + // "type": "string" + // } + // }, + // "required": [ + // "TimeOfDay", + // "TimeZone" + // ], + // "type": "object" + // } + // }, + // "required": [ + // "StartTime" + // ], + // "type": "object" + // }, + // "Monthly": { + // "additionalProperties": false, + // "properties": { + // "Day": { + // "enum": [ + // "MON", + // "TUE", + // "WED", + // "THU", + // "FRI", + // "SAT", + // "SUN" + // ], + // "type": "string" + // }, + // "StartTime": { + // "additionalProperties": false, + // "properties": { + // "TimeOfDay": { + // "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", + // "type": "string" + // }, + // "TimeZone": { + // "type": "string" + // } + // }, + // "required": [ + // "TimeOfDay", + // "TimeZone" + // ], + // "type": "object" + // } + // }, + // "required": [ + // "StartTime", + // "Day" + // ], + // "type": "object" + // }, + // "OneTime": { + // "type": "object" + // }, + // "Weekly": { + // "additionalProperties": false, + // "properties": { + // "Days": { + // "items": { + // "enum": [ + // "MON", + // "TUE", + // "WED", + // "THU", + // "FRI", + // "SAT", + // "SUN" + // ], + // "type": "string" + // }, + // "maxItems": 7, + // "minItems": 1, + // "type": "array", + // "uniqueItems": true + // }, + // "StartTime": { + // "additionalProperties": false, + // "properties": { + // "TimeOfDay": { + // "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", + // "type": "string" + // }, + // "TimeZone": { + // "type": "string" + // } + // }, + // "required": [ + // "TimeOfDay", + // "TimeZone" + // ], + // "type": "object" + // } + // }, + // "required": [ + // "StartTime", + // "Days" + // ], + // "type": "object" + // } + // } + // } + "schedule": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Daily + "daily": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: StartTime + "start_time": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: TimeOfDay + "time_of_day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.RegexMatches(regexp.MustCompile("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"), ""), + }, /*END VALIDATORS*/ + }, /*END ATTRIBUTE*/ + // Property: TimeZone + "time_zone": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Monthly + "monthly": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Day + "day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.OneOf( + "MON", + "TUE", + "WED", + "THU", + "FRI", + "SAT", + "SUN", + ), + }, /*END VALIDATORS*/ + }, /*END ATTRIBUTE*/ + // Property: StartTime + "start_time": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: TimeOfDay + "time_of_day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.RegexMatches(regexp.MustCompile("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"), ""), + }, /*END VALIDATORS*/ + }, /*END ATTRIBUTE*/ + // Property: TimeZone + "time_zone": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: OneTime + "one_time": schema.StringAttribute{ /*START ATTRIBUTE*/ + CustomType: jsontypes.NormalizedType{}, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Weekly + "weekly": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Days + "days": schema.ListAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Required: true, + Validators: []validator.List{ /*START VALIDATORS*/ + listvalidator.SizeBetween(1, 7), + listvalidator.UniqueValues(), + listvalidator.ValueStringsAre( + stringvalidator.OneOf( + "MON", + "TUE", + "WED", + "THU", + "FRI", + "SAT", + "SUN", + ), + ), + }, /*END VALIDATORS*/ + }, /*END ATTRIBUTE*/ + // Property: StartTime + "start_time": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: TimeOfDay + "time_of_day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.RegexMatches(regexp.MustCompile("^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"), ""), + }, /*END VALIDATORS*/ + }, /*END ATTRIBUTE*/ + // Property: TimeZone + "time_zone": schema.StringAttribute{ /*START ATTRIBUTE*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Required: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Description: "Choose a Schedule cadence", + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: SecurityLevel + // CloudFormation resource type schema: + // + // { + // "enum": [ + // "LEVEL_1", + // "LEVEL_2" + // ], + // "type": "string" + // } + "security_level": schema.StringAttribute{ /*START ATTRIBUTE*/ + Optional: true, + Computed: true, + Validators: []validator.String{ /*START VALIDATORS*/ + stringvalidator.OneOf( + "LEVEL_1", + "LEVEL_2", + ), + }, /*END VALIDATORS*/ + PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/ + stringplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Tags + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "pattern": "^.{1,255}$", + // "type": "string" + // } + // }, + // "type": "object" + // } + "tags": // Pattern: "" + schema.MapAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Map{ /*START PLAN MODIFIERS*/ + mapplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + // Property: Targets + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "properties": { + // "AccountIds": { + // "items": { + // "pattern": "^\\d{12}|ALL_MEMBERS|SELF$", + // "type": "string" + // }, + // "maxItems": 10000, + // "minItems": 1, + // "type": "array", + // "uniqueItems": true + // }, + // "TargetResourceTags": { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "items": { + // "type": "string" + // }, + // "maxItems": 5, + // "minItems": 1, + // "type": "array", + // "uniqueItems": true + // } + // } + // } + // }, + // "required": [ + // "AccountIds" + // ] + // } + "targets": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: AccountIds + "account_ids": schema.ListAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Required: true, + Validators: []validator.List{ /*START VALIDATORS*/ + listvalidator.SizeBetween(1, 10000), + listvalidator.UniqueValues(), + listvalidator.ValueStringsAre( + stringvalidator.RegexMatches(regexp.MustCompile("^\\d{12}|ALL_MEMBERS|SELF$"), ""), + ), + }, /*END VALIDATORS*/ + }, /*END ATTRIBUTE*/ + // Property: TargetResourceTags + "target_resource_tags": // Pattern: "" + schema.MapAttribute{ /*START ATTRIBUTE*/ + ElementType: types.ListType{ElemType: types.StringType}, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Map{ /*START PLAN MODIFIERS*/ + mapplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/ + objectplanmodifier.UseStateForUnknown(), + }, /*END PLAN MODIFIERS*/ + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + // Corresponds to CloudFormation primaryIdentifier. + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + } + + schema := schema.Schema{ + Description: "CIS Scan Configuration resource schema", + Version: 1, + Attributes: attributes, + } + + var opts generic.ResourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::InspectorV2::CisScanConfiguration").WithTerraformTypeName("awscc_inspectorv2_cis_scan_configuration") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "account_ids": "AccountIds", + "arn": "Arn", + "daily": "Daily", + "day": "Day", + "days": "Days", + "monthly": "Monthly", + "one_time": "OneTime", + "scan_name": "ScanName", + "schedule": "Schedule", + "security_level": "SecurityLevel", + "start_time": "StartTime", + "tags": "Tags", + "target_resource_tags": "TargetResourceTags", + "targets": "Targets", + "time_of_day": "TimeOfDay", + "time_zone": "TimeZone", + "weekly": "Weekly", + }) + + opts = opts.WithCreateTimeoutInMinutes(0).WithDeleteTimeoutInMinutes(0) + + opts = opts.WithUpdateTimeoutInMinutes(0) + + v, err := generic.NewResource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/inspectorv2/cis_scan_configuration_resource_gen_test.go b/internal/aws/inspectorv2/cis_scan_configuration_resource_gen_test.go new file mode 100644 index 0000000000..7dce4d0ba8 --- /dev/null +++ b/internal/aws/inspectorv2/cis_scan_configuration_resource_gen_test.go @@ -0,0 +1,46 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/resource/main.go; DO NOT EDIT. + +package inspectorv2_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSInspectorV2CisScanConfiguration_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::InspectorV2::CisScanConfiguration", "awscc_inspectorv2_cis_scan_configuration", "test") + + td.ResourceTest(t, []resource.TestStep{ + { + Config: td.EmptyConfig(), + Check: resource.ComposeTestCheckFunc( + td.CheckExistsInAWS(), + ), + }, + { + ResourceName: td.ResourceName, + ImportState: true, + ImportStateVerify: true, + }, + }) +} + +func TestAccAWSInspectorV2CisScanConfiguration_disappears(t *testing.T) { + td := acctest.NewTestData(t, "AWS::InspectorV2::CisScanConfiguration", "awscc_inspectorv2_cis_scan_configuration", "test") + + td.ResourceTest(t, []resource.TestStep{ + { + Config: td.EmptyConfig(), + Check: resource.ComposeTestCheckFunc( + td.CheckExistsInAWS(), + td.DeleteResource(), + ), + ExpectNonEmptyPlan: true, + }, + }) +} diff --git a/internal/provider/all_schemas.hcl b/internal/provider/all_schemas.hcl index df0ae84c7c..1212530c5d 100644 --- a/internal/provider/all_schemas.hcl +++ b/internal/provider/all_schemas.hcl @@ -820,11 +820,6 @@ resource_schema "aws_cognito_identity_pool_principal_tag" { resource_schema "aws_cognito_identity_pool_role_attachment" { cloudformation_type_name = "AWS::Cognito::IdentityPoolRoleAttachment" suppress_plural_data_source_generation = true - - # Suppression Reason: RoleMappings is of unsupported type: "" - # https://github.com/hashicorp/terraform-provider-awscc/issues/1505 - suppress_resource_generation = true - suppress_singular_data_source_generation = true } resource_schema "aws_cognito_log_delivery_configuration" { @@ -2292,12 +2287,6 @@ resource_schema "aws_inspector_resource_group" { resource_schema "aws_inspectorv2_cis_scan_configuration" { cloudformation_type_name = "AWS::InspectorV2::CisScanConfiguration" - - # Suppression Reason: Targets/TargetResourceTags is of unsupported type: "" - # https://github.com/hashicorp/terraform-provider-awscc/issues/1507 - suppress_resource_generation = true - suppress_singular_data_source_generation = true - suppress_plural_data_source_generation = true } resource_schema "aws_inspectorv2_filter" { diff --git a/internal/provider/plural_data_sources.go b/internal/provider/plural_data_sources.go index f9e9331b82..74d1543f2e 100644 --- a/internal/provider/plural_data_sources.go +++ b/internal/provider/plural_data_sources.go @@ -369,6 +369,7 @@ //go:generate go run generators/plural-data-source/main.go -data-source awscc_imagebuilder_lifecycle_policies -cftype AWS::ImageBuilder::LifecyclePolicy -package imagebuilder ../aws/imagebuilder/lifecycle_policy_plural_data_source_gen.go ../aws/imagebuilder/lifecycle_policy_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_inspector_assessment_targets -cftype AWS::Inspector::AssessmentTarget -package inspector ../aws/inspector/assessment_target_plural_data_source_gen.go ../aws/inspector/assessment_target_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_inspector_assessment_templates -cftype AWS::Inspector::AssessmentTemplate -package inspector ../aws/inspector/assessment_template_plural_data_source_gen.go ../aws/inspector/assessment_template_plural_data_source_gen_test.go +//go:generate go run generators/plural-data-source/main.go -data-source awscc_inspectorv2_cis_scan_configurations -cftype AWS::InspectorV2::CisScanConfiguration -package inspectorv2 ../aws/inspectorv2/cis_scan_configuration_plural_data_source_gen.go ../aws/inspectorv2/cis_scan_configuration_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_inspectorv2_filters -cftype AWS::InspectorV2::Filter -package inspectorv2 ../aws/inspectorv2/filter_plural_data_source_gen.go ../aws/inspectorv2/filter_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_internetmonitor_monitors -cftype AWS::InternetMonitor::Monitor -package internetmonitor ../aws/internetmonitor/monitor_plural_data_source_gen.go ../aws/internetmonitor/monitor_plural_data_source_gen_test.go //go:generate go run generators/plural-data-source/main.go -data-source awscc_iot_account_audit_configurations -cftype AWS::IoT::AccountAuditConfiguration -package iot ../aws/iot/account_audit_configuration_plural_data_source_gen.go ../aws/iot/account_audit_configuration_plural_data_source_gen_test.go diff --git a/internal/provider/resources.go b/internal/provider/resources.go index 9bfc7cb932..cd1f8a2d27 100644 --- a/internal/provider/resources.go +++ b/internal/provider/resources.go @@ -175,6 +175,7 @@ //go:generate go run generators/resource/main.go -resource awscc_codestarnotifications_notification_rule -cfschema ../service/cloudformation/schemas/AWS_CodeStarNotifications_NotificationRule.json -package codestarnotifications -- ../aws/codestarnotifications/notification_rule_resource_gen.go ../aws/codestarnotifications/notification_rule_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_cognito_identity_pool -cfschema ../service/cloudformation/schemas/AWS_Cognito_IdentityPool.json -package cognito -- ../aws/cognito/identity_pool_resource_gen.go ../aws/cognito/identity_pool_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_cognito_identity_pool_principal_tag -cfschema ../service/cloudformation/schemas/AWS_Cognito_IdentityPoolPrincipalTag.json -package cognito -- ../aws/cognito/identity_pool_principal_tag_resource_gen.go ../aws/cognito/identity_pool_principal_tag_resource_gen_test.go +//go:generate go run generators/resource/main.go -resource awscc_cognito_identity_pool_role_attachment -cfschema ../service/cloudformation/schemas/AWS_Cognito_IdentityPoolRoleAttachment.json -package cognito -- ../aws/cognito/identity_pool_role_attachment_resource_gen.go ../aws/cognito/identity_pool_role_attachment_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_cognito_log_delivery_configuration -cfschema ../service/cloudformation/schemas/AWS_Cognito_LogDeliveryConfiguration.json -package cognito -- ../aws/cognito/log_delivery_configuration_resource_gen.go ../aws/cognito/log_delivery_configuration_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_cognito_user_pool_client -cfschema ../service/cloudformation/schemas/AWS_Cognito_UserPoolClient.json -package cognito -- ../aws/cognito/user_pool_client_resource_gen.go ../aws/cognito/user_pool_client_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_cognito_user_pool_group -cfschema ../service/cloudformation/schemas/AWS_Cognito_UserPoolGroup.json -package cognito -- ../aws/cognito/user_pool_group_resource_gen.go ../aws/cognito/user_pool_group_resource_gen_test.go @@ -494,6 +495,7 @@ //go:generate go run generators/resource/main.go -resource awscc_inspector_assessment_target -cfschema ../service/cloudformation/schemas/AWS_Inspector_AssessmentTarget.json -package inspector -- ../aws/inspector/assessment_target_resource_gen.go ../aws/inspector/assessment_target_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_inspector_assessment_template -cfschema ../service/cloudformation/schemas/AWS_Inspector_AssessmentTemplate.json -package inspector -- ../aws/inspector/assessment_template_resource_gen.go ../aws/inspector/assessment_template_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_inspector_resource_group -cfschema ../service/cloudformation/schemas/AWS_Inspector_ResourceGroup.json -package inspector -- ../aws/inspector/resource_group_resource_gen.go ../aws/inspector/resource_group_resource_gen_test.go +//go:generate go run generators/resource/main.go -resource awscc_inspectorv2_cis_scan_configuration -cfschema ../service/cloudformation/schemas/AWS_InspectorV2_CisScanConfiguration.json -package inspectorv2 -- ../aws/inspectorv2/cis_scan_configuration_resource_gen.go ../aws/inspectorv2/cis_scan_configuration_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_inspectorv2_filter -cfschema ../service/cloudformation/schemas/AWS_InspectorV2_Filter.json -package inspectorv2 -- ../aws/inspectorv2/filter_resource_gen.go ../aws/inspectorv2/filter_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_internetmonitor_monitor -cfschema ../service/cloudformation/schemas/AWS_InternetMonitor_Monitor.json -package internetmonitor -- ../aws/internetmonitor/monitor_resource_gen.go ../aws/internetmonitor/monitor_resource_gen_test.go //go:generate go run generators/resource/main.go -resource awscc_iot_account_audit_configuration -cfschema ../service/cloudformation/schemas/AWS_IoT_AccountAuditConfiguration.json -package iot -- ../aws/iot/account_audit_configuration_resource_gen.go ../aws/iot/account_audit_configuration_resource_gen_test.go diff --git a/internal/provider/singular_data_sources.go b/internal/provider/singular_data_sources.go index efc751920d..6b81e1b765 100644 --- a/internal/provider/singular_data_sources.go +++ b/internal/provider/singular_data_sources.go @@ -175,6 +175,7 @@ //go:generate go run generators/singular-data-source/main.go -data-source awscc_codestarnotifications_notification_rule -cfschema ../service/cloudformation/schemas/AWS_CodeStarNotifications_NotificationRule.json -package codestarnotifications ../aws/codestarnotifications/notification_rule_singular_data_source_gen.go ../aws/codestarnotifications/notification_rule_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_cognito_identity_pool -cfschema ../service/cloudformation/schemas/AWS_Cognito_IdentityPool.json -package cognito ../aws/cognito/identity_pool_singular_data_source_gen.go ../aws/cognito/identity_pool_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_cognito_identity_pool_principal_tag -cfschema ../service/cloudformation/schemas/AWS_Cognito_IdentityPoolPrincipalTag.json -package cognito ../aws/cognito/identity_pool_principal_tag_singular_data_source_gen.go ../aws/cognito/identity_pool_principal_tag_singular_data_source_gen_test.go +//go:generate go run generators/singular-data-source/main.go -data-source awscc_cognito_identity_pool_role_attachment -cfschema ../service/cloudformation/schemas/AWS_Cognito_IdentityPoolRoleAttachment.json -package cognito ../aws/cognito/identity_pool_role_attachment_singular_data_source_gen.go ../aws/cognito/identity_pool_role_attachment_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_cognito_log_delivery_configuration -cfschema ../service/cloudformation/schemas/AWS_Cognito_LogDeliveryConfiguration.json -package cognito ../aws/cognito/log_delivery_configuration_singular_data_source_gen.go ../aws/cognito/log_delivery_configuration_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_cognito_user_pool_client -cfschema ../service/cloudformation/schemas/AWS_Cognito_UserPoolClient.json -package cognito ../aws/cognito/user_pool_client_singular_data_source_gen.go ../aws/cognito/user_pool_client_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_cognito_user_pool_group -cfschema ../service/cloudformation/schemas/AWS_Cognito_UserPoolGroup.json -package cognito ../aws/cognito/user_pool_group_singular_data_source_gen.go ../aws/cognito/user_pool_group_singular_data_source_gen_test.go @@ -494,6 +495,7 @@ //go:generate go run generators/singular-data-source/main.go -data-source awscc_inspector_assessment_target -cfschema ../service/cloudformation/schemas/AWS_Inspector_AssessmentTarget.json -package inspector ../aws/inspector/assessment_target_singular_data_source_gen.go ../aws/inspector/assessment_target_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_inspector_assessment_template -cfschema ../service/cloudformation/schemas/AWS_Inspector_AssessmentTemplate.json -package inspector ../aws/inspector/assessment_template_singular_data_source_gen.go ../aws/inspector/assessment_template_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_inspector_resource_group -cfschema ../service/cloudformation/schemas/AWS_Inspector_ResourceGroup.json -package inspector ../aws/inspector/resource_group_singular_data_source_gen.go ../aws/inspector/resource_group_singular_data_source_gen_test.go +//go:generate go run generators/singular-data-source/main.go -data-source awscc_inspectorv2_cis_scan_configuration -cfschema ../service/cloudformation/schemas/AWS_InspectorV2_CisScanConfiguration.json -package inspectorv2 ../aws/inspectorv2/cis_scan_configuration_singular_data_source_gen.go ../aws/inspectorv2/cis_scan_configuration_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_inspectorv2_filter -cfschema ../service/cloudformation/schemas/AWS_InspectorV2_Filter.json -package inspectorv2 ../aws/inspectorv2/filter_singular_data_source_gen.go ../aws/inspectorv2/filter_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_internetmonitor_monitor -cfschema ../service/cloudformation/schemas/AWS_InternetMonitor_Monitor.json -package internetmonitor ../aws/internetmonitor/monitor_singular_data_source_gen.go ../aws/internetmonitor/monitor_singular_data_source_gen_test.go //go:generate go run generators/singular-data-source/main.go -data-source awscc_iot_account_audit_configuration -cfschema ../service/cloudformation/schemas/AWS_IoT_AccountAuditConfiguration.json -package iot ../aws/iot/account_audit_configuration_singular_data_source_gen.go ../aws/iot/account_audit_configuration_singular_data_source_gen_test.go From 973e2f97a3efb59cadbf63ac0e024a93c80cd882 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 15:04:18 -0400 Subject: [PATCH 5/9] Run 'go get github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go@v0.23.0 && go mod tidy'. --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f5af472c53..6b2a544afc 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/cloudcontrol v1.18.7 github.com/aws/aws-sdk-go-v2/service/cloudformation v1.50.3 github.com/google/go-cmp v0.6.0 - github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.1-0.20240521184254-e6d3bb9dab7d + github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.23.0 github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 github.com/hashicorp/cli v1.1.6 github.com/hashicorp/go-hclog v1.6.3 diff --git a/go.sum b/go.sum index af578b4296..6e9f1085be 100644 --- a/go.sum +++ b/go.sum @@ -110,8 +110,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.1-0.20240521184254-e6d3bb9dab7d h1:iK50nA4Mb02irwPla9i5H2HUdvy8gdeROHs1rVqH0d8= -github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.1-0.20240521184254-e6d3bb9dab7d/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= +github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.23.0 h1:l16/Vrl0+x+HjHJWEjcKPwHYoxN9EC78gAFXKlH6m84= +github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.23.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 h1:jgOMbQlypMpUMaqYJotjT7ERSMvQP00Mppgjgh8lNt8= github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53/go.mod h1:nvpXIeF0ANfZ7sMssXKSSR3pyXfksajxoC2tl4jjN08= github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= From 768228b7272ab38b830bd6f03eec1b97c537475c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 15:13:17 -0400 Subject: [PATCH 6/9] Run 'make resources'. --- internal/aws/apigatewayv2/route_response_resource_gen.go | 1 + .../aws/cognito/identity_pool_role_attachment_resource_gen.go | 1 + .../aws/inspectorv2/cis_scan_configuration_resource_gen.go | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/aws/apigatewayv2/route_response_resource_gen.go b/internal/aws/apigatewayv2/route_response_resource_gen.go index 260d3fedfb..30fc2e5e02 100644 --- a/internal/aws/apigatewayv2/route_response_resource_gen.go +++ b/internal/aws/apigatewayv2/route_response_resource_gen.go @@ -7,6 +7,7 @@ package apigatewayv2 import ( "context" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" diff --git a/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go b/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go index 0abe140c05..5397810a8c 100644 --- a/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go +++ b/internal/aws/cognito/identity_pool_role_attachment_resource_gen.go @@ -7,6 +7,7 @@ package cognito import ( "context" + "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapplanmodifier" diff --git a/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go b/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go index 7cc86635e1..1c2ecb5e60 100644 --- a/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go +++ b/internal/aws/inspectorv2/cis_scan_configuration_resource_gen.go @@ -7,6 +7,8 @@ package inspectorv2 import ( "context" + "regexp" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -20,7 +22,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-provider-awscc/internal/generic" "github.com/hashicorp/terraform-provider-awscc/internal/registry" - "regexp" ) func init() { From 4105ff1d9ba7e606218bfb9dee74563064989fda Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 15:21:41 -0400 Subject: [PATCH 7/9] Run 'make singular-data-sources'. --- ...route_response_singular_data_source_gen.go | 164 ++++++++ ..._response_singular_data_source_gen_test.go | 36 ++ ...ole_attachment_singular_data_source_gen.go | 213 ++++++++++ ...ttachment_singular_data_source_gen_test.go | 36 ++ ..._configuration_singular_data_source_gen.go | 376 ++++++++++++++++++ ...iguration_singular_data_source_gen_test.go | 40 ++ 6 files changed, 865 insertions(+) create mode 100644 internal/aws/apigatewayv2/route_response_singular_data_source_gen.go create mode 100644 internal/aws/apigatewayv2/route_response_singular_data_source_gen_test.go create mode 100644 internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen.go create mode 100644 internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen_test.go create mode 100644 internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen.go create mode 100644 internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen_test.go diff --git a/internal/aws/apigatewayv2/route_response_singular_data_source_gen.go b/internal/aws/apigatewayv2/route_response_singular_data_source_gen.go new file mode 100644 index 0000000000..2dec2c9a03 --- /dev/null +++ b/internal/aws/apigatewayv2/route_response_singular_data_source_gen.go @@ -0,0 +1,164 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package apigatewayv2 + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" +) + +func init() { + registry.AddDataSourceFactory("awscc_apigatewayv2_route_response", routeResponseDataSource) +} + +// routeResponseDataSource returns the Terraform awscc_apigatewayv2_route_response data source. +// This Terraform data source corresponds to the CloudFormation AWS::ApiGatewayV2::RouteResponse resource. +func routeResponseDataSource(ctx context.Context) (datasource.DataSource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: ApiId + // CloudFormation resource type schema: + // + // { + // "description": "The API identifier.", + // "type": "string" + // } + "api_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The API identifier.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ModelSelectionExpression + // CloudFormation resource type schema: + // + // { + // "description": "The model selection expression for the route response. Supported only for WebSocket APIs.", + // "type": "string" + // } + "model_selection_expression": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The model selection expression for the route response. Supported only for WebSocket APIs.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ResponseModels + // CloudFormation resource type schema: + // + // { + // "description": "The response models for the route response.", + // "type": "object" + // } + "response_models": schema.StringAttribute{ /*START ATTRIBUTE*/ + CustomType: jsontypes.NormalizedType{}, + Description: "The response models for the route response.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ResponseParameters + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "description": "The route response parameters.", + // "patternProperties": { + // "": { + // "additionalProperties": false, + // "description": "Specifies whether the parameter is required.", + // "properties": { + // "Required": { + // "description": "Specifies whether the parameter is required.", + // "type": "boolean" + // } + // }, + // "required": [ + // "Required" + // ], + // "type": "object" + // } + // } + // } + "response_parameters": // Pattern: "" + schema.MapNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Required + "required": schema.BoolAttribute{ /*START ATTRIBUTE*/ + Description: "Specifies whether the parameter is required.", + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Description: "The route response parameters.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: RouteId + // CloudFormation resource type schema: + // + // { + // "description": "The route ID.", + // "type": "string" + // } + "route_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The route ID.", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: RouteResponseId + // CloudFormation resource type schema: + // + // { + // "description": "", + // "type": "string" + // } + "route_response_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: RouteResponseKey + // CloudFormation resource type schema: + // + // { + // "description": "The route response key.", + // "type": "string" + // } + "route_response_key": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "The route response key.", + Computed: true, + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Required: true, + } + + schema := schema.Schema{ + Description: "Data Source schema for AWS::ApiGatewayV2::RouteResponse", + Attributes: attributes, + } + + var opts generic.DataSourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::ApiGatewayV2::RouteResponse").WithTerraformTypeName("awscc_apigatewayv2_route_response") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "api_id": "ApiId", + "model_selection_expression": "ModelSelectionExpression", + "required": "Required", + "response_models": "ResponseModels", + "response_parameters": "ResponseParameters", + "route_id": "RouteId", + "route_response_id": "RouteResponseId", + "route_response_key": "RouteResponseKey", + }) + + v, err := generic.NewSingularDataSource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/apigatewayv2/route_response_singular_data_source_gen_test.go b/internal/aws/apigatewayv2/route_response_singular_data_source_gen_test.go new file mode 100644 index 0000000000..e22995c806 --- /dev/null +++ b/internal/aws/apigatewayv2/route_response_singular_data_source_gen_test.go @@ -0,0 +1,36 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package apigatewayv2_test + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSApiGatewayV2RouteResponseDataSource_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::ApiGatewayV2::RouteResponse", "awscc_apigatewayv2_route_response", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.EmptyDataSourceConfig(), + ExpectError: regexp.MustCompile("Missing required argument"), + }, + }) +} + +func TestAccAWSApiGatewayV2RouteResponseDataSource_NonExistent(t *testing.T) { + td := acctest.NewTestData(t, "AWS::ApiGatewayV2::RouteResponse", "awscc_apigatewayv2_route_response", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.DataSourceWithNonExistentIDConfig(), + ExpectError: regexp.MustCompile("Not Found"), + }, + }) +} diff --git a/internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen.go b/internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen.go new file mode 100644 index 0000000000..2b46e5dbff --- /dev/null +++ b/internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen.go @@ -0,0 +1,213 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package cognito + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" +) + +func init() { + registry.AddDataSourceFactory("awscc_cognito_identity_pool_role_attachment", identityPoolRoleAttachmentDataSource) +} + +// identityPoolRoleAttachmentDataSource returns the Terraform awscc_cognito_identity_pool_role_attachment data source. +// This Terraform data source corresponds to the CloudFormation AWS::Cognito::IdentityPoolRoleAttachment resource. +func identityPoolRoleAttachmentDataSource(ctx context.Context) (datasource.DataSource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Id + // CloudFormation resource type schema: + // + // { + // "type": "string" + // } + "identity_pool_role_attachment_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: IdentityPoolId + // CloudFormation resource type schema: + // + // { + // "type": "string" + // } + "identity_pool_id": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: RoleMappings + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "additionalProperties": false, + // "properties": { + // "AmbiguousRoleResolution": { + // "type": "string" + // }, + // "IdentityProvider": { + // "type": "string" + // }, + // "RulesConfiguration": { + // "additionalProperties": false, + // "properties": { + // "Rules": { + // "insertionOrder": false, + // "items": { + // "additionalProperties": false, + // "properties": { + // "Claim": { + // "type": "string" + // }, + // "MatchType": { + // "type": "string" + // }, + // "RoleARN": { + // "type": "string" + // }, + // "Value": { + // "type": "string" + // } + // }, + // "required": [ + // "Claim", + // "MatchType", + // "RoleARN", + // "Value" + // ], + // "type": "object" + // }, + // "type": "array", + // "uniqueItems": false + // } + // }, + // "required": [ + // "Rules" + // ], + // "type": "object" + // }, + // "Type": { + // "type": "string" + // } + // }, + // "required": [ + // "Type" + // ], + // "type": "object" + // } + // } + // } + "role_mappings": // Pattern: "" + schema.MapNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: AmbiguousRoleResolution + "ambiguous_role_resolution": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: IdentityProvider + "identity_provider": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: RulesConfiguration + "rules_configuration": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Rules + "rules": schema.ListNestedAttribute{ /*START ATTRIBUTE*/ + NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Claim + "claim": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: MatchType + "match_type": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: RoleARN + "role_arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Value + "value": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Type + "type": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + }, /*END NESTED OBJECT*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Roles + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "type": "string" + // } + // } + // } + "roles": // Pattern: "" + schema.MapAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Computed: true, + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Required: true, + } + + schema := schema.Schema{ + Description: "Data Source schema for AWS::Cognito::IdentityPoolRoleAttachment", + Attributes: attributes, + } + + var opts generic.DataSourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::Cognito::IdentityPoolRoleAttachment").WithTerraformTypeName("awscc_cognito_identity_pool_role_attachment") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "ambiguous_role_resolution": "AmbiguousRoleResolution", + "claim": "Claim", + "identity_pool_id": "IdentityPoolId", + "identity_pool_role_attachment_id": "Id", + "identity_provider": "IdentityProvider", + "match_type": "MatchType", + "role_arn": "RoleARN", + "role_mappings": "RoleMappings", + "roles": "Roles", + "rules": "Rules", + "rules_configuration": "RulesConfiguration", + "type": "Type", + "value": "Value", + }) + + v, err := generic.NewSingularDataSource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen_test.go b/internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen_test.go new file mode 100644 index 0000000000..73bc9b3d97 --- /dev/null +++ b/internal/aws/cognito/identity_pool_role_attachment_singular_data_source_gen_test.go @@ -0,0 +1,36 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package cognito_test + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSCognitoIdentityPoolRoleAttachmentDataSource_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Cognito::IdentityPoolRoleAttachment", "awscc_cognito_identity_pool_role_attachment", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.EmptyDataSourceConfig(), + ExpectError: regexp.MustCompile("Missing required argument"), + }, + }) +} + +func TestAccAWSCognitoIdentityPoolRoleAttachmentDataSource_NonExistent(t *testing.T) { + td := acctest.NewTestData(t, "AWS::Cognito::IdentityPoolRoleAttachment", "awscc_cognito_identity_pool_role_attachment", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.DataSourceWithNonExistentIDConfig(), + ExpectError: regexp.MustCompile("Not Found"), + }, + }) +} diff --git a/internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen.go b/internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen.go new file mode 100644 index 0000000000..8b9a11beaf --- /dev/null +++ b/internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen.go @@ -0,0 +1,376 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package inspectorv2 + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-provider-awscc/internal/generic" + "github.com/hashicorp/terraform-provider-awscc/internal/registry" +) + +func init() { + registry.AddDataSourceFactory("awscc_inspectorv2_cis_scan_configuration", cisScanConfigurationDataSource) +} + +// cisScanConfigurationDataSource returns the Terraform awscc_inspectorv2_cis_scan_configuration data source. +// This Terraform data source corresponds to the CloudFormation AWS::InspectorV2::CisScanConfiguration resource. +func cisScanConfigurationDataSource(ctx context.Context) (datasource.DataSource, error) { + attributes := map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Arn + // CloudFormation resource type schema: + // + // { + // "description": "CIS Scan configuration unique identifier", + // "type": "string" + // } + "arn": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "CIS Scan configuration unique identifier", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: ScanName + // CloudFormation resource type schema: + // + // { + // "description": "Name of the scan", + // "minLength": 1, + // "type": "string" + // } + "scan_name": schema.StringAttribute{ /*START ATTRIBUTE*/ + Description: "Name of the scan", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Schedule + // CloudFormation resource type schema: + // + // { + // "description": "Choose a Schedule cadence", + // "properties": { + // "Daily": { + // "additionalProperties": false, + // "properties": { + // "StartTime": { + // "additionalProperties": false, + // "properties": { + // "TimeOfDay": { + // "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", + // "type": "string" + // }, + // "TimeZone": { + // "type": "string" + // } + // }, + // "required": [ + // "TimeOfDay", + // "TimeZone" + // ], + // "type": "object" + // } + // }, + // "required": [ + // "StartTime" + // ], + // "type": "object" + // }, + // "Monthly": { + // "additionalProperties": false, + // "properties": { + // "Day": { + // "enum": [ + // "MON", + // "TUE", + // "WED", + // "THU", + // "FRI", + // "SAT", + // "SUN" + // ], + // "type": "string" + // }, + // "StartTime": { + // "additionalProperties": false, + // "properties": { + // "TimeOfDay": { + // "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", + // "type": "string" + // }, + // "TimeZone": { + // "type": "string" + // } + // }, + // "required": [ + // "TimeOfDay", + // "TimeZone" + // ], + // "type": "object" + // } + // }, + // "required": [ + // "StartTime", + // "Day" + // ], + // "type": "object" + // }, + // "OneTime": { + // "type": "object" + // }, + // "Weekly": { + // "additionalProperties": false, + // "properties": { + // "Days": { + // "items": { + // "enum": [ + // "MON", + // "TUE", + // "WED", + // "THU", + // "FRI", + // "SAT", + // "SUN" + // ], + // "type": "string" + // }, + // "maxItems": 7, + // "minItems": 1, + // "type": "array", + // "uniqueItems": true + // }, + // "StartTime": { + // "additionalProperties": false, + // "properties": { + // "TimeOfDay": { + // "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", + // "type": "string" + // }, + // "TimeZone": { + // "type": "string" + // } + // }, + // "required": [ + // "TimeOfDay", + // "TimeZone" + // ], + // "type": "object" + // } + // }, + // "required": [ + // "StartTime", + // "Days" + // ], + // "type": "object" + // } + // } + // } + "schedule": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Daily + "daily": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: StartTime + "start_time": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: TimeOfDay + "time_of_day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: TimeZone + "time_zone": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Monthly + "monthly": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Day + "day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: StartTime + "start_time": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: TimeOfDay + "time_of_day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: TimeZone + "time_zone": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: OneTime + "one_time": schema.StringAttribute{ /*START ATTRIBUTE*/ + CustomType: jsontypes.NormalizedType{}, + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Weekly + "weekly": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: Days + "days": schema.ListAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: StartTime + "start_time": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: TimeOfDay + "time_of_day": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: TimeZone + "time_zone": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Description: "Choose a Schedule cadence", + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: SecurityLevel + // CloudFormation resource type schema: + // + // { + // "enum": [ + // "LEVEL_1", + // "LEVEL_2" + // ], + // "type": "string" + // } + "security_level": schema.StringAttribute{ /*START ATTRIBUTE*/ + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Tags + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "pattern": "^.{1,255}$", + // "type": "string" + // } + // }, + // "type": "object" + // } + "tags": // Pattern: "" + schema.MapAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: Targets + // CloudFormation resource type schema: + // + // { + // "additionalProperties": false, + // "properties": { + // "AccountIds": { + // "items": { + // "pattern": "^\\d{12}|ALL_MEMBERS|SELF$", + // "type": "string" + // }, + // "maxItems": 10000, + // "minItems": 1, + // "type": "array", + // "uniqueItems": true + // }, + // "TargetResourceTags": { + // "additionalProperties": false, + // "patternProperties": { + // "": { + // "items": { + // "type": "string" + // }, + // "maxItems": 5, + // "minItems": 1, + // "type": "array", + // "uniqueItems": true + // } + // } + // } + // }, + // "required": [ + // "AccountIds" + // ] + // } + "targets": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/ + Attributes: map[string]schema.Attribute{ /*START SCHEMA*/ + // Property: AccountIds + "account_ids": schema.ListAttribute{ /*START ATTRIBUTE*/ + ElementType: types.StringType, + Computed: true, + }, /*END ATTRIBUTE*/ + // Property: TargetResourceTags + "target_resource_tags": // Pattern: "" + schema.MapAttribute{ /*START ATTRIBUTE*/ + ElementType: types.ListType{ElemType: types.StringType}, + Computed: true, + }, /*END ATTRIBUTE*/ + }, /*END SCHEMA*/ + Computed: true, + }, /*END ATTRIBUTE*/ + } /*END SCHEMA*/ + + attributes["id"] = schema.StringAttribute{ + Description: "Uniquely identifies the resource.", + Required: true, + } + + schema := schema.Schema{ + Description: "Data Source schema for AWS::InspectorV2::CisScanConfiguration", + Attributes: attributes, + } + + var opts generic.DataSourceOptions + + opts = opts.WithCloudFormationTypeName("AWS::InspectorV2::CisScanConfiguration").WithTerraformTypeName("awscc_inspectorv2_cis_scan_configuration") + opts = opts.WithTerraformSchema(schema) + opts = opts.WithAttributeNameMap(map[string]string{ + "account_ids": "AccountIds", + "arn": "Arn", + "daily": "Daily", + "day": "Day", + "days": "Days", + "monthly": "Monthly", + "one_time": "OneTime", + "scan_name": "ScanName", + "schedule": "Schedule", + "security_level": "SecurityLevel", + "start_time": "StartTime", + "tags": "Tags", + "target_resource_tags": "TargetResourceTags", + "targets": "Targets", + "time_of_day": "TimeOfDay", + "time_zone": "TimeZone", + "weekly": "Weekly", + }) + + v, err := generic.NewSingularDataSource(ctx, opts...) + + if err != nil { + return nil, err + } + + return v, nil +} diff --git a/internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen_test.go b/internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen_test.go new file mode 100644 index 0000000000..d8a35cf72b --- /dev/null +++ b/internal/aws/inspectorv2/cis_scan_configuration_singular_data_source_gen_test.go @@ -0,0 +1,40 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by generators/singular-data-source/main.go; DO NOT EDIT. + +package inspectorv2_test + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-awscc/internal/acctest" +) + +func TestAccAWSInspectorV2CisScanConfigurationDataSource_basic(t *testing.T) { + td := acctest.NewTestData(t, "AWS::InspectorV2::CisScanConfiguration", "awscc_inspectorv2_cis_scan_configuration", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.DataSourceWithEmptyResourceConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(fmt.Sprintf("data.%s", td.ResourceName), "id", td.ResourceName, "id"), + resource.TestCheckResourceAttrPair(fmt.Sprintf("data.%s", td.ResourceName), "arn", td.ResourceName, "arn"), + ), + }, + }) +} + +func TestAccAWSInspectorV2CisScanConfigurationDataSource_NonExistent(t *testing.T) { + td := acctest.NewTestData(t, "AWS::InspectorV2::CisScanConfiguration", "awscc_inspectorv2_cis_scan_configuration", "test") + + td.DataSourceTest(t, []resource.TestStep{ + { + Config: td.DataSourceWithNonExistentIDConfig(), + ExpectError: regexp.MustCompile("Not Found"), + }, + }) +} From 0baabbd175ad737b80dcd02546f4dc8b784c3e06 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 15:22:38 -0400 Subject: [PATCH 8/9] Run 'make docs'. --- .../apigatewayv2_route_response.md | 37 ++++++ .../cognito_identity_pool_role_attachment.md | 54 +++++++++ .../inspectorv2_cis_scan_configuration.md | 101 ++++++++++++++++ docs/resources/apigatewayv2_route_response.md | 48 ++++++++ .../cognito_identity_pool_role_attachment.md | 65 ++++++++++ .../inspectorv2_cis_scan_configuration.md | 112 ++++++++++++++++++ .../import.sh | 1 + .../import.sh | 1 + .../import.sh | 1 + 9 files changed, 420 insertions(+) create mode 100644 docs/data-sources/apigatewayv2_route_response.md create mode 100644 docs/data-sources/cognito_identity_pool_role_attachment.md create mode 100644 docs/data-sources/inspectorv2_cis_scan_configuration.md create mode 100644 docs/resources/apigatewayv2_route_response.md create mode 100644 docs/resources/cognito_identity_pool_role_attachment.md create mode 100644 docs/resources/inspectorv2_cis_scan_configuration.md create mode 100644 examples/resources/awscc_apigatewayv2_route_response/import.sh create mode 100644 examples/resources/awscc_cognito_identity_pool_role_attachment/import.sh create mode 100644 examples/resources/awscc_inspectorv2_cis_scan_configuration/import.sh diff --git a/docs/data-sources/apigatewayv2_route_response.md b/docs/data-sources/apigatewayv2_route_response.md new file mode 100644 index 0000000000..4664034b82 --- /dev/null +++ b/docs/data-sources/apigatewayv2_route_response.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_apigatewayv2_route_response Data Source - terraform-provider-awscc" +subcategory: "" +description: |- + Data Source schema for AWS::ApiGatewayV2::RouteResponse +--- + +# awscc_apigatewayv2_route_response (Data Source) + +Data Source schema for AWS::ApiGatewayV2::RouteResponse + + + + +## Schema + +### Required + +- `id` (String) Uniquely identifies the resource. + +### Read-Only + +- `api_id` (String) The API identifier. +- `model_selection_expression` (String) The model selection expression for the route response. Supported only for WebSocket APIs. +- `response_models` (String) The response models for the route response. +- `response_parameters` (Attributes Map) The route response parameters. (see [below for nested schema](#nestedatt--response_parameters)) +- `route_id` (String) The route ID. +- `route_response_id` (String) +- `route_response_key` (String) The route response key. + + +### Nested Schema for `response_parameters` + +Read-Only: + +- `required` (Boolean) Specifies whether the parameter is required. diff --git a/docs/data-sources/cognito_identity_pool_role_attachment.md b/docs/data-sources/cognito_identity_pool_role_attachment.md new file mode 100644 index 0000000000..499abca1f8 --- /dev/null +++ b/docs/data-sources/cognito_identity_pool_role_attachment.md @@ -0,0 +1,54 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_cognito_identity_pool_role_attachment Data Source - terraform-provider-awscc" +subcategory: "" +description: |- + Data Source schema for AWS::Cognito::IdentityPoolRoleAttachment +--- + +# awscc_cognito_identity_pool_role_attachment (Data Source) + +Data Source schema for AWS::Cognito::IdentityPoolRoleAttachment + + + + +## Schema + +### Required + +- `id` (String) Uniquely identifies the resource. + +### Read-Only + +- `identity_pool_id` (String) +- `identity_pool_role_attachment_id` (String) +- `role_mappings` (Attributes Map) (see [below for nested schema](#nestedatt--role_mappings)) +- `roles` (Map of String) + + +### Nested Schema for `role_mappings` + +Read-Only: + +- `ambiguous_role_resolution` (String) +- `identity_provider` (String) +- `rules_configuration` (Attributes) (see [below for nested schema](#nestedatt--role_mappings--rules_configuration)) +- `type` (String) + + +### Nested Schema for `role_mappings.rules_configuration` + +Read-Only: + +- `rules` (Attributes List) (see [below for nested schema](#nestedatt--role_mappings--rules_configuration--rules)) + + +### Nested Schema for `role_mappings.rules_configuration.rules` + +Read-Only: + +- `claim` (String) +- `match_type` (String) +- `role_arn` (String) +- `value` (String) diff --git a/docs/data-sources/inspectorv2_cis_scan_configuration.md b/docs/data-sources/inspectorv2_cis_scan_configuration.md new file mode 100644 index 0000000000..51e2c5fa82 --- /dev/null +++ b/docs/data-sources/inspectorv2_cis_scan_configuration.md @@ -0,0 +1,101 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_inspectorv2_cis_scan_configuration Data Source - terraform-provider-awscc" +subcategory: "" +description: |- + Data Source schema for AWS::InspectorV2::CisScanConfiguration +--- + +# awscc_inspectorv2_cis_scan_configuration (Data Source) + +Data Source schema for AWS::InspectorV2::CisScanConfiguration + + + + +## Schema + +### Required + +- `id` (String) Uniquely identifies the resource. + +### Read-Only + +- `arn` (String) CIS Scan configuration unique identifier +- `scan_name` (String) Name of the scan +- `schedule` (Attributes) Choose a Schedule cadence (see [below for nested schema](#nestedatt--schedule)) +- `security_level` (String) +- `tags` (Map of String) +- `targets` (Attributes) (see [below for nested schema](#nestedatt--targets)) + + +### Nested Schema for `schedule` + +Read-Only: + +- `daily` (Attributes) (see [below for nested schema](#nestedatt--schedule--daily)) +- `monthly` (Attributes) (see [below for nested schema](#nestedatt--schedule--monthly)) +- `one_time` (String) +- `weekly` (Attributes) (see [below for nested schema](#nestedatt--schedule--weekly)) + + +### Nested Schema for `schedule.daily` + +Read-Only: + +- `start_time` (Attributes) (see [below for nested schema](#nestedatt--schedule--daily--start_time)) + + +### Nested Schema for `schedule.daily.start_time` + +Read-Only: + +- `time_of_day` (String) +- `time_zone` (String) + + + + +### Nested Schema for `schedule.monthly` + +Read-Only: + +- `day` (String) +- `start_time` (Attributes) (see [below for nested schema](#nestedatt--schedule--monthly--start_time)) + + +### Nested Schema for `schedule.monthly.start_time` + +Read-Only: + +- `time_of_day` (String) +- `time_zone` (String) + + + + +### Nested Schema for `schedule.weekly` + +Read-Only: + +- `days` (List of String) +- `start_time` (Attributes) (see [below for nested schema](#nestedatt--schedule--weekly--start_time)) + + +### Nested Schema for `schedule.weekly.start_time` + +Read-Only: + +- `time_of_day` (String) +- `time_zone` (String) + + + + + +### Nested Schema for `targets` + +Read-Only: + +- `account_ids` (List of String) +- `target_resource_tags` (Map of List of String) diff --git a/docs/resources/apigatewayv2_route_response.md b/docs/resources/apigatewayv2_route_response.md new file mode 100644 index 0000000000..c999148c11 --- /dev/null +++ b/docs/resources/apigatewayv2_route_response.md @@ -0,0 +1,48 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_apigatewayv2_route_response Resource - terraform-provider-awscc" +subcategory: "" +description: |- + The AWS::ApiGatewayV2::RouteResponse resource creates a route response for a WebSocket API. For more information, see Set up Route Responses for a WebSocket API in API Gateway https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-response.html in the API Gateway Developer Guide. +--- + +# awscc_apigatewayv2_route_response (Resource) + +The ``AWS::ApiGatewayV2::RouteResponse`` resource creates a route response for a WebSocket API. For more information, see [Set up Route Responses for a WebSocket API in API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-response.html) in the *API Gateway Developer Guide*. + + + + +## Schema + +### Required + +- `api_id` (String) The API identifier. +- `route_id` (String) The route ID. +- `route_response_key` (String) The route response key. + +### Optional + +- `model_selection_expression` (String) The model selection expression for the route response. Supported only for WebSocket APIs. +- `response_models` (String) The response models for the route response. +- `response_parameters` (Attributes Map) The route response parameters. (see [below for nested schema](#nestedatt--response_parameters)) + +### Read-Only + +- `id` (String) Uniquely identifies the resource. +- `route_response_id` (String) + + +### Nested Schema for `response_parameters` + +Optional: + +- `required` (Boolean) Specifies whether the parameter is required. + +## Import + +Import is supported using the following syntax: + +```shell +$ terraform import awscc_apigatewayv2_route_response.example +``` diff --git a/docs/resources/cognito_identity_pool_role_attachment.md b/docs/resources/cognito_identity_pool_role_attachment.md new file mode 100644 index 0000000000..66be8a2da2 --- /dev/null +++ b/docs/resources/cognito_identity_pool_role_attachment.md @@ -0,0 +1,65 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_cognito_identity_pool_role_attachment Resource - terraform-provider-awscc" +subcategory: "" +description: |- + Resource Type definition for AWS::Cognito::IdentityPoolRoleAttachment +--- + +# awscc_cognito_identity_pool_role_attachment (Resource) + +Resource Type definition for AWS::Cognito::IdentityPoolRoleAttachment + + + + +## Schema + +### Required + +- `identity_pool_id` (String) + +### Optional + +- `role_mappings` (Attributes Map) (see [below for nested schema](#nestedatt--role_mappings)) +- `roles` (Map of String) + +### Read-Only + +- `id` (String) Uniquely identifies the resource. +- `identity_pool_role_attachment_id` (String) + + +### Nested Schema for `role_mappings` + +Optional: + +- `ambiguous_role_resolution` (String) +- `identity_provider` (String) +- `rules_configuration` (Attributes) (see [below for nested schema](#nestedatt--role_mappings--rules_configuration)) +- `type` (String) + + +### Nested Schema for `role_mappings.rules_configuration` + +Required: + +- `rules` (Attributes List) (see [below for nested schema](#nestedatt--role_mappings--rules_configuration--rules)) + + +### Nested Schema for `role_mappings.rules_configuration.rules` + +Required: + +- `claim` (String) +- `match_type` (String) +- `role_arn` (String) +- `value` (String) + +## Import + +Import is supported using the following syntax: + +```shell +$ terraform import awscc_cognito_identity_pool_role_attachment.example +``` diff --git a/docs/resources/inspectorv2_cis_scan_configuration.md b/docs/resources/inspectorv2_cis_scan_configuration.md new file mode 100644 index 0000000000..43ceae855c --- /dev/null +++ b/docs/resources/inspectorv2_cis_scan_configuration.md @@ -0,0 +1,112 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "awscc_inspectorv2_cis_scan_configuration Resource - terraform-provider-awscc" +subcategory: "" +description: |- + CIS Scan Configuration resource schema +--- + +# awscc_inspectorv2_cis_scan_configuration (Resource) + +CIS Scan Configuration resource schema + + + + +## Schema + +### Optional + +- `scan_name` (String) Name of the scan +- `schedule` (Attributes) Choose a Schedule cadence (see [below for nested schema](#nestedatt--schedule)) +- `security_level` (String) +- `tags` (Map of String) +- `targets` (Attributes) (see [below for nested schema](#nestedatt--targets)) + +### Read-Only + +- `arn` (String) CIS Scan configuration unique identifier +- `id` (String) Uniquely identifies the resource. + + +### Nested Schema for `schedule` + +Optional: + +- `daily` (Attributes) (see [below for nested schema](#nestedatt--schedule--daily)) +- `monthly` (Attributes) (see [below for nested schema](#nestedatt--schedule--monthly)) +- `one_time` (String) +- `weekly` (Attributes) (see [below for nested schema](#nestedatt--schedule--weekly)) + + +### Nested Schema for `schedule.daily` + +Required: + +- `start_time` (Attributes) (see [below for nested schema](#nestedatt--schedule--daily--start_time)) + + +### Nested Schema for `schedule.daily.start_time` + +Required: + +- `time_of_day` (String) +- `time_zone` (String) + + + + +### Nested Schema for `schedule.monthly` + +Required: + +- `day` (String) +- `start_time` (Attributes) (see [below for nested schema](#nestedatt--schedule--monthly--start_time)) + + +### Nested Schema for `schedule.monthly.start_time` + +Required: + +- `time_of_day` (String) +- `time_zone` (String) + + + + +### Nested Schema for `schedule.weekly` + +Required: + +- `days` (List of String) +- `start_time` (Attributes) (see [below for nested schema](#nestedatt--schedule--weekly--start_time)) + + +### Nested Schema for `schedule.weekly.start_time` + +Required: + +- `time_of_day` (String) +- `time_zone` (String) + + + + + +### Nested Schema for `targets` + +Required: + +- `account_ids` (List of String) + +Optional: + +- `target_resource_tags` (Map of List of String) + +## Import + +Import is supported using the following syntax: + +```shell +$ terraform import awscc_inspectorv2_cis_scan_configuration.example +``` diff --git a/examples/resources/awscc_apigatewayv2_route_response/import.sh b/examples/resources/awscc_apigatewayv2_route_response/import.sh new file mode 100644 index 0000000000..592ac402fa --- /dev/null +++ b/examples/resources/awscc_apigatewayv2_route_response/import.sh @@ -0,0 +1 @@ +$ terraform import awscc_apigatewayv2_route_response.example \ No newline at end of file diff --git a/examples/resources/awscc_cognito_identity_pool_role_attachment/import.sh b/examples/resources/awscc_cognito_identity_pool_role_attachment/import.sh new file mode 100644 index 0000000000..0d00a828f3 --- /dev/null +++ b/examples/resources/awscc_cognito_identity_pool_role_attachment/import.sh @@ -0,0 +1 @@ +$ terraform import awscc_cognito_identity_pool_role_attachment.example \ No newline at end of file diff --git a/examples/resources/awscc_inspectorv2_cis_scan_configuration/import.sh b/examples/resources/awscc_inspectorv2_cis_scan_configuration/import.sh new file mode 100644 index 0000000000..f5d70df000 --- /dev/null +++ b/examples/resources/awscc_inspectorv2_cis_scan_configuration/import.sh @@ -0,0 +1 @@ +$ terraform import awscc_inspectorv2_cis_scan_configuration.example \ No newline at end of file From 045e1f1f3cb1efb088ce8802af740a63ee779f04 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 21 May 2024 15:24:04 -0400 Subject: [PATCH 9/9] Add CHANGELOG entries. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e784fd42a..a4921a18f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,13 @@ FEATURES: +* **New Data Source:** `awscc_apigatewayv2_route_response` +* **New Data Source:** `awscc_cognito_identity_pool_role_attachment` +* **New Data Source:** `awscc_inspectorv2_cis_scan_configuration` * **New Data Source:** `awscc_qbusiness_data_source` +* **New Resource:** `awscc_apigatewayv2_route_response` +* **New Resource:** `awscc_cognito_identity_pool_role_attachment` +* **New Resource:** `awscc_inspectorv2_cis_scan_configuration` * **New Resource:** `awscc_qbusiness_data_source` ## 0.77.0 (May 16, 2024)