Skip to content

Commit 3dcbb42

Browse files
committed
Removing provider block
1 parent 83ec287 commit 3dcbb42

File tree

5 files changed

+48
-119
lines changed

5 files changed

+48
-119
lines changed

.circleci/config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ jobs:
55
- image: hashicorp/terraform
66
steps:
77
- checkout
8-
- run: terraform init
9-
- run: terraform validate
8+
- run:
9+
working_directory: examples/test
10+
command: terraform init
11+
- run:
12+
working_directory: examples/test
13+
command: terraform validate

README.md

Lines changed: 3 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -15,109 +15,16 @@ Check versions for this module on:
1515
* Github Releases: <https://github.com/cn-terraform/terraform-aws-ecs-fargate-scheduled-task/releases>
1616
* Terraform Module Registry: <https://registry.terraform.io/modules/cn-terraform/ecs-fargate-scheduled-task/aws>
1717

18-
module "scheduled_task" {
19-
source = "cn-terraform/ecs-fargate-scheduled-task/aws"
20-
version = "1.0.6"
21-
name_preffix = var.name_preffix
22-
profile = var.profile
23-
region = var.region
24-
ecs_cluster_arn = module.ecs-cluster.aws_ecs_cluster_cluster_arn
25-
event_rule_name = <RULE_NAME>
26-
ecs_execution_task_role_arn = module.td.aws_iam_role_ecs_task_execution_role_arn
27-
event_rule_schedule_expression = <SCHEDULE_EXPRESSION>
28-
event_rule_event_pattern = <EVENT_PATTERN>
29-
event_target_ecs_target_task_definition_arn = module.td.aws_ecs_task_definition_td_arn
30-
event_target_ecs_target_subnets = module.networking.private_subnets_ids
31-
}
32-
33-
Check the section "Other modules that you may need to use this module" for details about modules mentioned in the usage example.
34-
35-
## Input values
36-
37-
* name_preffix: Name preffix for resources on AWS.
38-
* profile: AWS API key credentials to use.
39-
* region: AWS Region the infrastructure is hosted in.
40-
* ecs_cluster_arn: The ECS Cluster where the scheduled task will run.
41-
* event_rule_name: The rule's name.
42-
* event_target_ecs_target_subnets: The subnets associated with the task or service.
43-
* event_target_ecs_target_task_definition_arn: The ARN of the task definition to use if the event target is an Amazon ECS cluster.
44-
* ecs_execution_task_role_arn: (Required) The task definition execution role.
45-
* event_rule_schedule_expression: (Required, if event_pattern isn't specified) The scheduling expression. For example, cron(0 20 * * ? *) or rate(5 minutes).
46-
* event_rule_event_pattern: (Required, if schedule_expression isn't specified) Event pattern described a JSON object. See full documentation of CloudWatch Events and Event Patterns for details.
47-
* event_rule_description: (Optional) The description of the rule.
48-
* event_rule_role_arn: (Optional) The Amazon Resource Name (ARN) associated with the role that is used for target invocation.
49-
* event_rule_is_enabled: (Optional) Whether the rule should be enabled (defaults to true).
50-
* event_target_target_id: (Optional) The unique target assignment ID. If missing, will generate a random, unique id.
51-
* event_target_input: (Optional) Valid JSON text passed to the target.
52-
* event_target_input_path: (Optional) The value of the JSONPath that is used for extracting part of the matched event when passing it to the target.
53-
* event_target_ecs_target_security_groups: (Optional) The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
54-
* event_target_ecs_target_assign_public_ip: (Optional) Assign a public IP address to the ENI (Fargate launch type only). Valid values are true or false. Default false.
55-
* event_target_ecs_target_task_count: (Optional) The number of tasks to create based on the TaskDefinition. The default is 1.
56-
* event_target_ecs_target_platform_version: (Optional) Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as 1.1.0. This is used only if LaunchType is FARGATE.
57-
* event_target_ecs_target_group: (Optional) Specifies an ECS task group for the task. The maximum length is 255 characters.
58-
59-
## Output values
60-
61-
* scheduled_task_cw_event_role_arn: The Amazon Resource Name (ARN) specifying the role.
62-
* scheduled_task_cw_event_role_create_date: The creation date of the IAM role.
63-
* scheduled_task_cw_event_role_description: The description of the role.
64-
* scheduled_task_cw_event_role_id: The name of the role.
65-
* scheduled_task_cw_event_role_name: The name of the role.
66-
* scheduled_task_cw_event_role_unique_id: The stable and unique string identifying the role.
67-
* aws_iam_role_policy_scheduled_task_cw_event_role_cloudwatch_policy_id: The role policy ID, in the form of role_name:role_policy_name.
68-
* aws_iam_role_policy_scheduled_task_cw_event_role_cloudwatch_policy_name: The name of the policy.
69-
* aws_iam_role_policy_scheduled_task_cw_event_role_cloudwatch_policy_policy: The policy document attached to the role.
70-
* aws_iam_role_policy_scheduled_task_cw_event_role_cloudwatch_policy_role: The name of the role associated with the policy.
71-
* aws_cloudwatch_event_rule_event_rule_arn: The Amazon Resource Name (ARN) of the CloudWatch Event Rule.
72-
7318
## Other modules that you may need to use this module
7419

75-
The networking module should look like this:
76-
77-
module "networking" {
78-
source = "cn-terraform/networking/aws"
79-
version = "2.0.5"
80-
name_preffix = var.name_preffix
81-
profile = var.profile
82-
region = var.region
83-
vpc_cidr_block = "192.168.0.0/16"
84-
availability_zones = [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d" ]
85-
public_subnets_cidrs_per_availability_zone = [ "192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19" ]
86-
private_subnets_cidrs_per_availability_zone = [ "192.168.128.0/19", "192.168.160.0/19", "192.168.192.0/19", "192.168.224.0/19" ]
87-
}
88-
89-
Check versions for this module on:
20+
The Networking module:
9021
* Github Releases: <https://github.com/cn-terraform/terraform-aws-networking/releases>
9122
* Terraform Module Registry: <https://registry.terraform.io/modules/cn-terraform/networking/aws>
9223

93-
The ECS cluster module should look like this:
94-
95-
module "ecs-cluster":
96-
source = "cn-terraform/ecs-cluster/aws"
97-
version = "1.0.3"
98-
name_preffix = var.name_preffix
99-
profile = var.profile
100-
region = var.region
101-
}
102-
103-
Check versions for this module on:
24+
The ECS Cluster module:
10425
* Github Releases: <https://github.com/cn-terraform/terraform-aws-ecs-cluster/releases>
10526
* Terraform Module Registry: <https://registry.terraform.io/modules/cn-terraform/ecs-cluster/aws>
10627

107-
The task definition module should like this:
108-
109-
module "td" {
110-
source = "cn-terraform/ecs-fargate-task-definition/aws"
111-
version = "1.0.8"
112-
name_preffix = var.name_preffix
113-
profile = var.profile
114-
region = var.region
115-
container_name = "${var.name_preffix}-<NAME>"
116-
container_image = "<IMAGE_NAME>:<IMAGE_TAG>"
117-
container_port = <PORT>
118-
}
119-
120-
Check versions for this module on:
28+
The ECS Task Definition module:
12129
* Github Releases: <https://github.com/cn-terraform/terraform-aws-ecs-fargate-task-definition/releases>
12230
* Terraform Module Registry: <https://registry.terraform.io/modules/cn-terraform/ecs-fargate-task-definition/aws>
123-

examples/test/main.tf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
provider "aws" {
2+
region = "us-east-1"
3+
}
4+
5+
module "base-network" {
6+
source = "cn-terraform/networking/aws"
7+
version = "2.0.7"
8+
name_preffix = "test-networking"
9+
vpc_cidr_block = "192.168.0.0/16"
10+
availability_zones = [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d" ]
11+
public_subnets_cidrs_per_availability_zone = [ "192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19" ]
12+
private_subnets_cidrs_per_availability_zone = [ "192.168.128.0/19", "192.168.160.0/19", "192.168.192.0/19", "192.168.224.0/19" ]
13+
}
14+
15+
module "cluster" {
16+
source = "cn-terraform/ecs-cluster/aws"
17+
version = "1.0.5"
18+
name = "test-cluster"
19+
}
20+
21+
module "td" {
22+
source = "cn-terraform/ecs-fargate-task-definition/aws"
23+
version = "1.0.11"
24+
name_preffix = "test-td"
25+
container_image = "ubuntu"
26+
container_name = "test"
27+
}
28+
29+
module "task" {
30+
source = "../../"
31+
name_preffix = "test-task"
32+
event_rule_name = "test-rule"
33+
ecs_cluster_arn = module.cluster.aws_ecs_cluster_cluster_arn
34+
event_target_ecs_target_subnets = module.base-network.public_subnets_ids
35+
event_target_ecs_target_task_definition_arn = module.td.aws_ecs_task_definition_td_arn
36+
ecs_execution_task_role_arn = "Put your role ARN here"
37+
}

main.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# ---------------------------------------------------------------------------------------------------------------------
2-
# PROVIDER
3-
# ---------------------------------------------------------------------------------------------------------------------
4-
provider "aws" {
5-
profile = var.profile
6-
region = var.region
7-
}
8-
91
# ---------------------------------------------------------------------------------------------------------------------
102
# CLOUDWATCH EVENT ROLE
113
# ---------------------------------------------------------------------------------------------------------------------

variables.tf

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@ variable "name_preffix" {
55
description = "Name preffix for resources on AWS"
66
}
77

8-
# ---------------------------------------------------------------------------------------------------------------------
9-
# AWS CREDENTIALS AND REGION
10-
# ---------------------------------------------------------------------------------------------------------------------
11-
variable "profile" {
12-
description = "AWS API key credentials to use"
13-
}
14-
15-
variable "region" {
16-
description = "AWS Region the infrastructure is hosted in"
17-
}
18-
198
# ---------------------------------------------------------------------------------------------------------------------
209
# CLOUDWATCH EVENT RULE
2110
# ---------------------------------------------------------------------------------------------------------------------
@@ -65,8 +54,8 @@ variable "event_target_ecs_target_task_definition_arn" {
6554
description = "(Required) The ARN of the task definition to use if the event target is an Amazon ECS cluster."
6655
}
6756

68-
variable "ecs_execution_task_role_arn" {
69-
description = "(Required) The task definition execution role"
57+
variable "ecs_execution_task_role_arn" {
58+
description = "(Required) The task definition execution role"
7059
}
7160

7261
variable "event_target_target_id" {

0 commit comments

Comments
 (0)