Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Terraform] Error: InvalidPermission.Duplicate: the specified rule

Posted on March 14, 2023 By nim No Comments on [Terraform] Error: InvalidPermission.Duplicate: the specified rule

Contents

Toggle
  • Remove Inbound Rule in the Security Group
  • Remove Outbound Rule in the Security Group

Remove Inbound Rule in the Security Group

Lỗi sau là mình gặp sau khi upgrade module eks từ 1.18 -> 1,19

╷
│ Error: [WARN] A duplicate Security Group rule was found on (sg-097d3d8e8df7f57a4). This may be
│ a side effect of a now-fixed Terraform issue causing two security groups with
│ identical attributes but different source_security_group_ids to overwrite each
│ other in the state. See https://github.com/hashicorp/terraform/pull/2376 for more
│ information and instructions for recovery. Error: InvalidPermission.Duplicate: the specified rule "peer: sg-0057a36d87dd949a5, TCP, from port: 4443, to port: 4443, ALLOW" already exists
│ 	status code: 400, request id: 7c0a36cb-a591-4b33-9666-b8c6f1091a7b
│ 
│   with module.eks.aws_security_group_rule.node["ingress_cluster_4443_webhook"],
│   on .terraform/modules/eks/node_groups.tf line 207, in resource "aws_security_group_rule" "node":
│  207: resource "aws_security_group_rule" "node" {
│ 
╵

Ở bản 1.19 đã được thêm như là mặc định

https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/node_groups.tf#L137-L145

Giờ mình cần xóa rule inbound này.
https://bobbyhadz.com/blog/aws-cli-remove-security-group-rule

aws ec2 describe-security-groups --profile <profile_name>

Bạn chịu khó list tất cả ra, xong dựa vào format bên dưới
Điểm đặc biệt đây là rule link với –source-group

aws ec2 revoke-security-group-ingress --group-id sg-097d3d8e8df7f57a4 --protocol tcp --port 4443 --source-group sg-0057a36d87dd949a5 --profile <profile_name>

Remove Outbound Rule in the Security Group

╷
│ Error: [WARN] A duplicate Security Group rule was found on (sg-097d3d8e8df7f57a4). This may be
│ a side effect of a now-fixed Terraform issue causing two security groups with
│ identical attributes but different source_security_group_ids to overwrite each
│ other in the state. See https://github.com/hashicorp/terraform/pull/2376 for more
│ information and instructions for recovery. Error: InvalidPermission.Duplicate: the specified rule "peer: 0.0.0.0/0, ALL, ALLOW" already exists
│   status code: 400, request id: 81cacc55-d28b-49df-aca2-ababa290a998
│ 
│   with module.eks.aws_security_group_rule.node["egress_all"],
│   on .terraform/modules/eks/node_groups.tf line 207, in resource "aws_security_group_rule" "node":
│  207: resource "aws_security_group_rule" "node" {
│ 
╵
Releasing state lock. This may take a few moments...
aws ec2 describe-security-groups --profile <profile_name>

xong bạn muốn ép chúng thành 1 dòng thì paste it to address bar of Browser

aws ec2 revoke-security-group-egress \
    --profile <profile_name> \
    --group-id sg-097d3d8e8df7f57a4 \
    --ip-permissions '[ { "IpProtocol": "-1", "IpRanges": [ { "CidrIp": "0.0.0.0/0", "Description": "Node all egress" } ], "Ipv6Ranges": [ { "CidrIpv6": "::/0", "Description": "Node all egress" } ], "PrefixListIds": [], "UserIdGroupPairs": [] } ]'
AWS - Amazon Web Service

Post navigation

Previous Post: [terraform] Error: InvalidPermission.Duplicate: the specified rule
Next Post: [Kubernetes] volume node affinity conflict

More Related Articles

[Aws] Access S3 or bucket from other account AWS AWS - Amazon Web Service
[S3] Try to compare S3 express One Zone with S3 standard. AWS - Amazon Web Service
[AWS] Deploying Redis on AWS AWS - Amazon Web Service
[Ec2] How to reset the forgotten password on EC2 AWS - Amazon Web Service
[S3/AWS] How to reduce S3’s cost by the gateway and interface endpoints (PrivateLink) AWS - Amazon Web Service
[Kaniko/Bitbucket/ECR] Accomplish the workflow: CI by bitbucket pipeline, Kaniko build image and push image to ECR AWS - Amazon Web Service

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Azure/Loadbalancer] Creating an internal load balancer on Azure Kubernetes Service (AKS). May 13, 2025
  • [Azure] The subscription is not registered to use namespace ‘Microsoft.ContainerService’ May 8, 2025
  • [Azure] Insufficient regional vcpu quota left May 8, 2025
  • [WordPress] How to add a Dynamic watermark on WordPress. May 6, 2025
  • [vnet/Azure] VNet provisioning via Terraform. April 28, 2025

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.