Skip to content

Commit

Permalink
Merge pull request #122 from ditrit/feature/adding_metadata
Browse files Browse the repository at this point in the history
Feature: adding metadata
  • Loading branch information
Zorin95670 authored Jul 23, 2024
2 parents 712cdd5 + a9cc432 commit 63b4d53
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 195 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unreleased]

### Added

- Default attributes for metadata.

## [0.10.0] - 2024/07/11

### Added
Expand Down
26 changes: 5 additions & 21 deletions src/assets/metadata/aws/compute.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { securityGroups, subnetId } from 'src/assets/metadata/aws/default';

const awsInstance = {
type: 'aws_instance',
blockType: 'resource',
Expand All @@ -11,14 +13,8 @@ const awsInstance = {
tags: [],
definedAttributes: [
{
name: 'security_groups',
displayName: 'Security groups',
description: 'List of security group names to associate with.',
linkAttribute: 'name',
linkRef: 'aws_security_group',
...securityGroups,
linkType: 'Reverse',
linkModel: 'defaultLink',
type: 'Link',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#security_groups',
},
{
Expand All @@ -33,14 +29,8 @@ const awsInstance = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#vpc_security_group_ids',
},
{
name: 'subnet_id',
displayName: 'Subnet ID',
...subnetId,
description: 'The VPC Subnet ID to launch in.',
linkAttribute: 'id',
linkRef: 'aws_subnet',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#subnet_id',
},
],
Expand Down Expand Up @@ -120,13 +110,7 @@ const awsLaunchConfiguration = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_configuration.html#name_prefix',
},
{
name: 'security_groups',
displayName: 'Security groups',
description: 'A list of associated security group IDS.',
linkRef: 'aws_security_group',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
...securityGroups,
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_configuration.html#security_groups',
},
{
Expand Down
15 changes: 4 additions & 11 deletions src/assets/metadata/aws/databases.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { port, tags } from 'src/assets/metadata/aws/default';

const awsDbInstance = {
type: 'aws_db_instance',
blockType: 'resource',
Expand Down Expand Up @@ -290,15 +292,9 @@ const awsDbInstance = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance#performance_insights_retention_period',
},
{
name: 'port',
displayName: 'Port',
...port,
description: 'The port on which the DB accepts connections.',
type: 'Number',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance#port',
rules: {
max: '65535',
min: '1',
},
},
{
name: 'replica_mode',
Expand Down Expand Up @@ -458,10 +454,7 @@ const awsDbInstance = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance#customer_owned_ip_enabled',
},
{
name: 'tags',
displayName: 'Tags',
description: 'A mapping of tags to assign to the DB instance.',
type: 'Object',
...tags,
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance#tags',
},
],
Expand Down
63 changes: 63 additions & 0 deletions src/assets/metadata/aws/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
export const vpcIdLink = {
name: 'vpc_id',
displayName: 'VPC ID',
containerRef: 'aws_vpc',
linkAttribute: 'id',
linkRef: 'aws_vpc',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
};

export const vpcIdReference = {
name: 'vpc_id',
displayName: 'VPC ID',
containerRef: 'aws_vpc',
type: 'Reference',
};

export const tags = {
name: 'tags',
displayName: 'Tags',
description: 'A map of tags to assign to the resource.',
type: 'Object',
url: 'https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html',
};

export const securityGroups = {
name: 'security_groups',
displayName: 'Security groups',
description: 'List of security group names to associate with.',
linkAttribute: 'name',
linkRef: 'aws_security_group',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
};

export const subnetId = {
name: 'subnet_id',
displayName: 'Subnet ID',
linkAttribute: 'id',
linkRef: 'aws_subnet',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
};

export const port = {
name: 'port',
displayName: 'Port',
type: 'Number',
rules: {
max: '65535',
min: '1',
},
};

export const ipv6Address = {
name: 'ipv6_address',
displayName: 'IPv6 address',
description: 'The IPv6 address.',
type: 'String',
};
82 changes: 22 additions & 60 deletions src/assets/metadata/aws/loadbalancing.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import {
ipv6Address,
port,
securityGroups, subnetId,
tags,
vpcIdLink,
vpcIdReference,
} from 'src/assets/metadata/aws/default';

const awsElb = {
type: 'aws_elb',
blockType: 'resource',
Expand Down Expand Up @@ -64,14 +73,7 @@ const awsElb = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elb#subnets',
},
{
name: 'security_groups',
displayName: 'Security groups',
description: 'A list of security group IDs to assign to the ELB.',
linkAttribute: 'id',
linkRef: 'aws_security_group',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
...securityGroups,
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elb#security_groups',
},
{
Expand Down Expand Up @@ -101,11 +103,8 @@ const awsLb = {
tags: [],
definedAttributes: [
{
name: 'vpc_id',
displayName: 'VPC ID',
...vpcIdReference,
description: 'The ID of the VPC to create the ALB in.',
containerRef: 'aws_vpc',
type: 'Reference',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#vpc_id',
},
{
Expand Down Expand Up @@ -249,13 +248,7 @@ const awsLb = {
},
},
{
name: 'security_groups',
displayName: 'Security groups',
description: 'A list of security group IDs to assign to the LB. Only valid for Load Balancers of type application.',
linkRef: 'aws_security_group',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
...securityGroups,
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#security_groups',
},
{
Expand All @@ -273,10 +266,8 @@ const awsLb = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#subnet_mapping',
definedAttributes: [
{
name: 'subnet_id',
displayName: 'Subnet ID',
...subnetId,
description: 'ID of the subnet of which to attach to the load balancer. You can specify only one subnet per Availability Zone.',
type: 'String',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#subnet_id',
},
{
Expand All @@ -287,10 +278,8 @@ const awsLb = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#allocation_id',
},
{
name: 'ipv6_address',
displayName: 'IPv6 address',
...ipv6Address,
description: 'The IPv6 address. You associate IPv6 CIDR blocks with your VPC and choose the subnets <br>where you launch both internet-facing and internal Application Load Balancers or Network Load Balancers.',
type: 'String',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#ipv6_address',
},
{
Expand Down Expand Up @@ -320,10 +309,7 @@ const awsLb = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#name_prefix',
},
{
name: 'tags',
displayName: 'Tags',
description: 'A map of tags to assign to the resource. If configured with a provider default_tags configuration block present,<br>tags with matching keys will overwrite those defined at the provider-level.',
type: 'Object',
...tags,
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#tags',
},
],
Expand Down Expand Up @@ -390,10 +376,8 @@ const awsLbTargetGroup = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#name_prefix',
},
{
name: 'port',
displayName: 'Port',
...port,
description: 'Port on which targets receive traffic, unless overridden when registering a specific target.',
type: 'Number',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#port',
},
{
Expand Down Expand Up @@ -463,13 +447,8 @@ const awsLbTargetGroup = {
},
},
{
name: 'vpc_id',
displayName: 'VPC ID',
...vpcIdLink,
description: 'Identifier of the VPC in which to create the target group.',
linkRef: 'aws_vpc',
linkType: 'Default',
linkModel: 'defaultLink',
type: 'Link',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#vpc_id',
},
{
Expand Down Expand Up @@ -515,10 +494,8 @@ const awsLbTargetGroup = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#path',
},
{
name: 'port',
displayName: 'Port',
...port,
description: 'The port the load balancer uses when performing health checks on targets.',
type: 'Number',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group#port',
},
{
Expand Down Expand Up @@ -597,13 +574,7 @@ const awsLbTargetGroup = {
},
],
},
{
name: 'tags',
displayName: 'Tags',
description: 'A map of tags to assign to the resource.',
type: 'Object',
url: 'https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html',
},
tags,
{
name: 'target_failover',
displayName: 'Target failover',
Expand Down Expand Up @@ -704,21 +675,15 @@ const awsLbListener = {
},
{
name: 'certificate_arn',
displayName: 'Cerificate ARN',
displayName: 'Certificate ARN',
description: 'ARN of the default SSL server certificate.',
type: 'String',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener#certificate_arn',
},
{
name: 'port',
displayName: 'Port',
...port,
description: 'Port on which the load balancer is listening.',
type: 'Number',
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener#port',
rules: {
max: 65535,
min: 1,
},
},
{
name: 'protocol',
Expand Down Expand Up @@ -761,10 +726,7 @@ const awsLbListener = {
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener#ssl_policy',
},
{
name: 'tags',
displayName: 'Tags',
description: 'A mapping of tags to assign to the resource.',
type: 'Object',
...tags,
url: 'https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener#tags',
},
],
Expand Down
Loading

0 comments on commit 63b4d53

Please sign in to comment.