Skip to content

Commit

Permalink
100% aws data source coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWoolfenden committed Oct 1, 2024
1 parent 343b8dc commit e3b67b5
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

## checks out our code locally, so we can work with the files
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

## runs go test ./...
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
Expand All @@ -31,7 +31,7 @@ jobs:
with:
terraform_version: 1.5.4
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
Expand All @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
needs:
- goreleaser
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@82556589c08f584cb95411629a94e6c2b68b9b80 # v5
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:

## checks out our code locally, so we can work with the files
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

## runs go test ./...
- name: Build
run: go build -o ${{ github.workspace }} ./...


- name: Checkout AWS
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
repository: hashicorp/terraform-provider-aws
path: aws
Expand All @@ -34,7 +34,7 @@ jobs:
run: ${{ github.workspace }}/pike parse -d ${{ github.workspace }}/aws -name aws

- name: Checkout AZURERM
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
repository: hashicorp/terraform-provider-azurerm
path: azurerm
Expand All @@ -43,7 +43,7 @@ jobs:
run: ${{ github.workspace }}/pike parse -d ${{ github.workspace }}/azurerm -name azurerm

- name: Generate Google
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
repository: hashicorp/terraform-provider-google
path: google
Expand Down
12 changes: 8 additions & 4 deletions src/aws_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,14 @@ func AwsDataLookup(find string) interface{} { //nolint:maintidx
"aws_bedrockagent_agent_versions": dataAwsBedrockAgentVersions,
"aws_glue_registry": dataAwsGlueRegistry,
"aws_organizations_organizational_unit_descendant_organizational_units": dataAwsOrganizationsOrganizationalUnitDescendantOrganizationalUnits,
"aws_quicksight_analysis": dataAwsQuicksightAnalysis,
"aws_route53_zones": dataAwsRoute53Zones,
"aws_shield_protection": dataAwsShieldProtection,
"aws_ssoadmin_permission_sets": dataAwsSsoadminPermissionSets,
"aws_quicksight_analysis": dataAwsQuicksightAnalysis,
"aws_route53_zones": dataAwsRoute53Zones,
"aws_shield_protection": dataAwsShieldProtection,
"aws_ssoadmin_permission_sets": dataAwsSsoadminPermissionSets,
"aws_codebuild_fleet": dataAwsCodebuildFleet,
"aws_elasticache_reserved_cache_node_offering": dataAwsElasticacheReservedCacheNodeOffering,
"aws_synthetics_runtime_version": dataAwsSyntheticsRuntimeVersion,
"aws_synthetics_runtime_versions": dataAwsSytheticsRuntimeVersions,
}

return TFLookup[find]
Expand Down
6 changes: 1 addition & 5 deletions src/coverage/aws.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# todo aws

Resource percentage coverage 72.23
Datasource percentage coverage 99.28
Datasource percentage coverage 100.00

./resource.ps1 aws_amplify_backend_environment
./resource.ps1 aws_amplify_webhook
Expand Down Expand Up @@ -397,7 +397,3 @@ Datasource percentage coverage 99.28
./resource.ps1 aws_wafregional_web_acl_association
./resource.ps1 aws_worklink_fleet
./resource.ps1 aws_worklink_website_certificate_authority_association
./resource.ps1 aws_codebuild_fleet -type data
./resource.ps1 aws_elasticache_reserved_cache_node_offering -type data
./resource.ps1 aws_synthetics_runtime_version -type data
./resource.ps1 aws_synthetics_runtime_versions -type data
12 changes: 12 additions & 0 deletions src/files_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1500,3 +1500,15 @@ var dataAwsShieldProtection []byte

//go:embed mapping/aws/data/sso/aws_ssoadmin_permission_sets.json
var dataAwsSsoadminPermissionSets []byte

//go:embed mapping/aws/data/codebuild/aws_codebuild_fleet.json
var dataAwsCodebuildFleet []byte

//go:embed mapping/aws/data/elasticache/aws_elasticache_reserved_cache_node_offering.json
var dataAwsElasticacheReservedCacheNodeOffering []byte

//go:embed mapping/aws/data/synthetics/aws_synthetics_runtime_version.json
var dataAwsSyntheticsRuntimeVersion []byte

//go:embed mapping/aws/data/synthetics/aws_synthetics_runtime_versions.json
var dataAwsSytheticsRuntimeVersions []byte
13 changes: 13 additions & 0 deletions src/mapping/aws/data/codebuild/aws_codebuild_fleet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"apply": [],
"attributes": {
"tags": []
},
"destroy": [],
"modify": [],
"plan": [
"codebuild:BatchGetFleets"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"apply": [],
"attributes": {
"tags": []
},
"destroy": [],
"modify": [],
"plan": [
"elasticache:DescribeReservedCacheNodesOfferings"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"apply": [],
"attributes": {
"tags": []
},
"destroy": [],
"modify": [],
"plan": [
"synthetics:DescribeRuntimeVersions"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"apply": [],
"attributes": {
"tags": []
},
"destroy": [],
"modify": [],
"plan": [
"synthetics:DescribeRuntimeVersions"
]
}
]
7 changes: 7 additions & 0 deletions terraform/aws/backup/data.aws_codebuild_fleet.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "aws_codebuild_fleet" "pike" {
name = "pike"
}

output "aws_codebuild_fleet" {
value = data.aws_codebuild_fleet.pike
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
data "aws_elasticache_reserved_cache_node_offering" "pike" {
cache_node_type = "cache. t4g. small"
duration = "P1Y"
offering_type = "No Upfront"
product_description = "redis"
}

output "aws_elasticache_reserved_cache_node_offering" {
value = data.aws_elasticache_reserved_cache_node_offering.pike
}
8 changes: 8 additions & 0 deletions terraform/aws/backup/data.aws_synthetics_runtime_version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data "aws_synthetics_runtime_version" "pike" {
prefix = "syn-nodejs-puppeteer"
latest = true
}

output "aws_synthetics_runtime_version" {
value = data.aws_synthetics_runtime_version.pike
}
6 changes: 6 additions & 0 deletions terraform/aws/backup/data.aws_synthetics_runtime_versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "aws_synthetics_runtime_versions" "pike" {
}

output "aws_synthetics_runtime_versions" {
value = data.aws_synthetics_runtime_versions.pike
}
22 changes: 8 additions & 14 deletions terraform/aws/role/aws_iam_policy.basic.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@ resource "aws_iam_policy" "basic" {
"Effect" : "Allow",
"Action" : [

//aws_codebuild_fleet
"codebuild:BatchGetFleets",

//aws_bedrockagent_agent_versions
//aws_elasticache_reserved_cache_node_offering
"elasticache:DescribeReservedCacheNodesOfferings",

//aws_shield_protection
//aws_synthetics_runtime_version
"synthetics:DescribeRuntimeVersions",


//aws_ssoadmin_permission_sets
"sso:ListInstances",

//aws_route53_zones
"route53:ListHostedZones",

//aws_quicksight_analysis
"quicksight:DescribeAnalysis",

//aws_glue_registry
"glue:GetRegistry"
//aws_synthetics_runtime_versions
"synthetics:DescribeRuntimeVersions"
],
"Resource" : "*",
}
Expand Down
7 changes: 0 additions & 7 deletions terraform/aws/test.tf

This file was deleted.

0 comments on commit e3b67b5

Please sign in to comment.